From 17f443ac3be562a93cb45b34dd7e9ad4d3ea1366 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 1 Jul 2015 03:49:58 -0400 Subject: [PATCH] Just squiggle the entire line for middle lines (sans trailing space). --- src/compiler/tsc.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 5f474b861fe..b920949c004 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -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