mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Just squiggle the entire line for middle lines (sans trailing space).
This commit is contained in:
@@ -116,23 +116,21 @@ namespace ts {
|
||||
|
||||
output += lineContent + sys.newLine;
|
||||
|
||||
output += redColorControlChar;
|
||||
if (i === 0) {
|
||||
let lastCharForLine = i === indexOfLastLine ? lastLineChar : undefined;
|
||||
|
||||
output += lineContent.slice(0, firstLineChar).replace(/\S/g, " ");
|
||||
output += redColorControlChar;
|
||||
output += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~");
|
||||
output += resetColorControlChar;
|
||||
}
|
||||
else if (i === indexOfLastLine) {
|
||||
output += redColorControlChar;
|
||||
output += lineContent.slice(0, lastLineChar).replace(/./g, "~");
|
||||
output += resetColorControlChar;
|
||||
// Don't bother "filling" at the end.
|
||||
}
|
||||
else {
|
||||
output += lineContent.replace(/^(\s*)(.*)$/, replaceLineWithRedSquiggles);
|
||||
output += lineContent.replace(/./g, "~");
|
||||
}
|
||||
output += resetColorControlChar;
|
||||
|
||||
output += sys.newLine;
|
||||
}
|
||||
@@ -147,10 +145,6 @@ namespace ts {
|
||||
sys.write(output);
|
||||
}
|
||||
|
||||
function replaceLineWithRedSquiggles(orig: string, leadingWhitespace: string, content: string): string {
|
||||
return leadingWhitespace + redColorControlChar + content.replace(/./g, "~") + resetColorControlChar;
|
||||
}
|
||||
|
||||
/** Splits the given string on \r\n, or on only \n if that fails, or on only \r if *that* fails. */
|
||||
function splitContentByNewlines(content: string) {
|
||||
// Split up the input file by line
|
||||
|
||||
Reference in New Issue
Block a user