@@ -268,7 +268,7 @@ namespace ts {
268268 return s ;
269269 }
270270
271- export function formatDiagnosticsWithColorAndContext ( diagnostics : Diagnostic [ ] , host : FormatDiagnosticsHost ) : string {
271+ export function formatDiagnosticsWithColorAndContext ( diagnostics : ReadonlyArray < Diagnostic > , host : FormatDiagnosticsHost ) : string {
272272 let output = "" ;
273273 for ( const diagnostic of diagnostics ) {
274274 if ( diagnostic . file ) {
@@ -284,12 +284,12 @@ namespace ts {
284284 gutterWidth = Math . max ( ellipsis . length , gutterWidth ) ;
285285 }
286286
287- output += sys . newLine ;
287+ output += host . getNewLine ( ) ;
288288 for ( let i = firstLine ; i <= lastLine ; i ++ ) {
289289 // If the error spans over 5 lines, we'll only show the first 2 and last 2 lines,
290290 // so we'll skip ahead to the second-to-last line.
291291 if ( hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1 ) {
292- output += formatAndReset ( padLeft ( ellipsis , gutterWidth ) , gutterStyleSequence ) + gutterSeparator + sys . newLine ;
292+ output += formatAndReset ( padLeft ( ellipsis , gutterWidth ) , gutterStyleSequence ) + gutterSeparator + host . getNewLine ( ) ;
293293 i = lastLine - 1 ;
294294 }
295295
@@ -301,7 +301,7 @@ namespace ts {
301301
302302 // Output the gutter and the actual contents of the line.
303303 output += formatAndReset ( padLeft ( i + 1 + "" , gutterWidth ) , gutterStyleSequence ) + gutterSeparator ;
304- output += lineContent + sys . newLine ;
304+ output += lineContent + host . getNewLine ( ) ;
305305
306306 // Output the gutter and the error span for the line using tildes.
307307 output += formatAndReset ( padLeft ( "" , gutterWidth ) , gutterStyleSequence ) + gutterSeparator ;
@@ -323,17 +323,17 @@ namespace ts {
323323 }
324324 output += resetEscapeSequence ;
325325
326- output += sys . newLine ;
326+ output += host . getNewLine ( ) ;
327327 }
328328
329- output += sys . newLine ;
329+ output += host . getNewLine ( ) ;
330330 output += `${ relativeFileName } (${ firstLine + 1 } ,${ firstLineChar + 1 } ): ` ;
331331 }
332332
333333 const categoryColor = getCategoryFormat ( diagnostic . category ) ;
334334 const category = DiagnosticCategory [ diagnostic . category ] . toLowerCase ( ) ;
335- output += `${ formatAndReset ( category , categoryColor ) } TS${ diagnostic . code } : ${ flattenDiagnosticMessageText ( diagnostic . messageText , sys . newLine ) } ` ;
336- output += sys . newLine ;
335+ output += `${ formatAndReset ( category , categoryColor ) } TS${ diagnostic . code } : ${ flattenDiagnosticMessageText ( diagnostic . messageText , host . getNewLine ( ) ) } ` ;
336+ output += host . getNewLine ( ) ;
337337 }
338338 return output ;
339339 }
0 commit comments