@@ -86,7 +86,6 @@ namespace ts {
86
86
87
87
if ( diagnostic . file ) {
88
88
let loc = getLineAndCharacterOfPosition ( diagnostic . file , diagnostic . start ) ;
89
-
90
89
output += `${ diagnostic . file . fileName } (${ loc . line + 1 } ,${ loc . character + 1 } ): ` ;
91
90
}
92
91
@@ -102,6 +101,19 @@ namespace ts {
102
101
}
103
102
}
104
103
104
+ function reportWatchDiagnostic ( diagnostic : Diagnostic ) {
105
+ let output = new Date ( ) . toLocaleTimeString ( ) + " - " ;
106
+
107
+ if ( diagnostic . file ) {
108
+ let loc = getLineAndCharacterOfPosition ( diagnostic . file , diagnostic . start ) ;
109
+ output += `${ diagnostic . file . fileName } (${ loc . line + 1 } ,${ loc . character + 1 } ): ` ;
110
+ }
111
+
112
+ output += `${ flattenDiagnosticMessageText ( diagnostic . messageText , sys . newLine ) } ${ sys . newLine } ` ;
113
+
114
+ sys . write ( output ) ;
115
+ }
116
+
105
117
function padLeft ( s : string , length : number ) {
106
118
while ( s . length < length ) {
107
119
s = " " + s ;
@@ -218,7 +230,7 @@ namespace ts {
218
230
219
231
let result = readConfigFile ( configFileName , sys . readFile ) ;
220
232
if ( result . error ) {
221
- reportDiagnostic ( result . error ) ;
233
+ reportWatchDiagnostic ( result . error ) ;
222
234
return sys . exit ( ExitStatus . DiagnosticsPresent_OutputsSkipped ) ;
223
235
}
224
236
@@ -247,7 +259,7 @@ namespace ts {
247
259
}
248
260
249
261
setCachedProgram ( compileResult . program ) ;
250
- reportDiagnostic ( createCompilerDiagnostic ( Diagnostics . Compilation_complete_Watching_for_file_changes ) ) ;
262
+ reportWatchDiagnostic ( createCompilerDiagnostic ( Diagnostics . Compilation_complete_Watching_for_file_changes ) ) ;
251
263
}
252
264
253
265
function getSourceFile ( fileName : string , languageVersion : ScriptTarget , onError ?: ( message : string ) => void ) {
@@ -309,7 +321,7 @@ namespace ts {
309
321
310
322
function recompile ( ) {
311
323
timerHandle = undefined ;
312
- reportDiagnostic ( createCompilerDiagnostic ( Diagnostics . File_change_detected_Starting_incremental_compilation ) ) ;
324
+ reportWatchDiagnostic ( createCompilerDiagnostic ( Diagnostics . File_change_detected_Starting_incremental_compilation ) ) ;
313
325
performCompilation ( ) ;
314
326
}
315
327
}
0 commit comments