@@ -101,23 +101,8 @@ namespace ts {
101
101
return < string > diagnostic . messageText ;
102
102
}
103
103
104
- function getRelativeFileName ( fileName : string , host : CompilerHost ) : string {
105
- return host ? convertToRelativePath ( fileName , host . getCurrentDirectory ( ) , fileName => host . getCanonicalFileName ( fileName ) ) : fileName ;
106
- }
107
-
108
104
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 ) ) ;
121
106
}
122
107
123
108
const redForegroundEscapeSequence = "\u001b[91m" ;
@@ -145,7 +130,7 @@ namespace ts {
145
130
const { line : firstLine , character : firstLineChar } = getLineAndCharacterOfPosition ( file , start ) ;
146
131
const { line : lastLine , character : lastLineChar } = getLineAndCharacterOfPosition ( file , start + length ) ;
147
132
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 ; ;
149
134
150
135
const hasMoreThanFiveLines = ( lastLine - firstLine ) >= 4 ;
151
136
let gutterWidth = ( lastLine + 1 + "" ) . length ;
0 commit comments