@@ -101,23 +101,8 @@ namespace ts {
101101 return < string > diagnostic . messageText ;
102102 }
103103
104- function getRelativeFileName ( fileName : string , host : CompilerHost ) : string {
105- return host ? convertToRelativePath ( fileName , host . getCurrentDirectory ( ) , fileName => host . getCanonicalFileName ( fileName ) ) : fileName ;
106- }
107-
108104 function reportDiagnosticSimply ( diagnostic : Diagnostic , host : CompilerHost ) : void {
109- let output = "" ;
110-
111- if ( diagnostic . file ) {
112- const { line, character } = getLineAndCharacterOfPosition ( diagnostic . file , diagnostic . start ) ;
113- const relativeFileName = getRelativeFileName ( diagnostic . file . fileName , host ) ;
114- output += `${ relativeFileName } (${ line + 1 } ,${ character + 1 } ): ` ;
115- }
116-
117- const category = DiagnosticCategory [ diagnostic . category ] . toLowerCase ( ) ;
118- output += `${ category } TS${ diagnostic . code } : ${ flattenDiagnosticMessageText ( diagnostic . messageText , sys . newLine ) } ${ sys . newLine } ` ;
119-
120- sys . write ( output ) ;
105+ sys . write ( ts . formatDiagnostics ( [ diagnostic ] , host ) ) ;
121106 }
122107
123108 const redForegroundEscapeSequence = "\u001b[91m" ;
@@ -145,7 +130,7 @@ namespace ts {
145130 const { line : firstLine , character : firstLineChar } = getLineAndCharacterOfPosition ( file , start ) ;
146131 const { line : lastLine , character : lastLineChar } = getLineAndCharacterOfPosition ( file , start + length ) ;
147132 const lastLineInFile = getLineAndCharacterOfPosition ( file , file . text . length ) . line ;
148- const relativeFileName = getRelativeFileName ( file . fileName , host ) ;
133+ const relativeFileName = host ? convertToRelativePath ( file . fileName , host . getCurrentDirectory ( ) , fileName => host . getCanonicalFileName ( fileName ) ) : file . fileName ; ;
149134
150135 const hasMoreThanFiveLines = ( lastLine - firstLine ) >= 4 ;
151136 let gutterWidth = ( lastLine + 1 + "" ) . length ;
0 commit comments