Microsoft/TypeScript

Not all leading tab characters in diagnostic messages are replaced with spaces

Open

#41.268 geöffnet am 27. Okt. 2020

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
BugDomain: Error MessagesHelp Wanted

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

The error diagnostics that are used by default do not replace ALL leading tab characters with a single space.

As one would expect from seeing this code line in souce code: https://github.com/microsoft/TypeScript/blob/85ef91e2233fa384e980005c109fadc04376ce3e/src/compiler/program.ts#L410

This line only replaces the first leading tab character. Which causes way too much leading whitespace printed in the logs when errors occur during tsc build.

TypeScript Version: 4.0.3

Search Terms: tabs diagnostics, reporter, formatCodeSpan, formatDiagnosticsWithColorAndContext, leading tabs,

Expected behavior: Source code has four leading tabs for indentation.

[line number] [gutter seperator] [space] [space] [space] [space] [line content]

image

Actual behavior: [line number] [gutter seperator] [space] [tab] [tab] [tab] [line content]

image

PR I can submit a PR for this that would change this line: lineContent = lineContent.replace("\t", " "); // convert tabs to single spaces to: lineContent = lineContent.replace(/\t/gy, " "); // convert all leading tabs to single spaces

Contributor Guide