mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-07 09:20:57 -05:00
@@ -44,6 +44,24 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
const screenStartingMessageCodes: number[] = [
|
||||
Diagnostics.Starting_compilation_in_watch_mode.code,
|
||||
Diagnostics.File_change_detected_Starting_incremental_compilation.code,
|
||||
];
|
||||
|
||||
function getPlainDiagnosticPrecedingNewLines(diagnostic: Diagnostic, newLine: string): string {
|
||||
return contains(screenStartingMessageCodes, diagnostic.code)
|
||||
? ""
|
||||
: newLine;
|
||||
}
|
||||
|
||||
function getPlainDiagnosticFollowingNewLines(diagnostic: Diagnostic, newLine: string): string {
|
||||
return contains(screenStartingMessageCodes, diagnostic.code)
|
||||
? newLine + newLine
|
||||
: newLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a function that reports watch status by writing to the system and handles the formating of the diagnostic
|
||||
*/
|
||||
@@ -52,13 +70,13 @@ namespace ts {
|
||||
(diagnostic, newLine, options) => {
|
||||
clearScreenIfNotWatchingForFileChanges(system, diagnostic, options);
|
||||
let output = `[${formatColorAndReset(new Date().toLocaleTimeString(), ForegroundColorEscapeSequences.Grey)}] `;
|
||||
output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${newLine + newLine + newLine}`;
|
||||
output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${newLine + newLine}`;
|
||||
system.write(output);
|
||||
} :
|
||||
(diagnostic, newLine, options) => {
|
||||
clearScreenIfNotWatchingForFileChanges(system, diagnostic, options);
|
||||
let output = new Date().toLocaleTimeString() + " - ";
|
||||
output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${newLine + newLine + newLine}`;
|
||||
let output = `${getPlainDiagnosticPrecedingNewLines(diagnostic, newLine)}${new Date().toLocaleTimeString()} - `;
|
||||
output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${getPlainDiagnosticFollowingNewLines(diagnostic, newLine)}`;
|
||||
system.write(output);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user