Merge pull request #23462 from JoshuaKGoldberg/combined-pretty-summaries

Combined "Found X error(s)" and "Compilation complete" --watch messages
This commit is contained in:
Mohamed Hegazy 2018-04-17 10:37:07 -07:00 committed by GitHub
commit ca53993e41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 18 deletions

View File

@ -2943,10 +2943,6 @@
"category": "Message",
"code": 6040
},
"Compilation complete. Watching for file changes.": {
"category": "Message",
"code": 6042
},
"Generates corresponding '.map' file.": {
"category": "Message",
"code": 6043
@ -3522,11 +3518,11 @@
"code": 6192,
"reportsUnnecessary": true
},
"Found 1 error.": {
"Found 1 error. Watching for file changes.": {
"category": "Message",
"code": 6193
},
"Found {0} errors.": {
"Found {0} errors. Watching for file changes.": {
"category": "Message",
"code": 6194
},

View File

@ -29,9 +29,8 @@ namespace ts {
/** @internal */
export const nonClearingMessageCodes: number[] = [
Diagnostics.Compilation_complete_Watching_for_file_changes.code,
Diagnostics.Found_1_error.code,
Diagnostics.Found_0_errors.code
Diagnostics.Found_1_error_Watching_for_file_changes.code,
Diagnostics.Found_0_errors_Watching_for_file_changes.code
];
function clearScreenIfNotWatchingForFileChanges(system: System, diagnostic: Diagnostic, options: CompilerOptions) {
@ -231,10 +230,10 @@ namespace ts {
const reportSummary = (errorCount: number) => {
if (errorCount === 1) {
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_1_error, errorCount), newLine, compilerOptions);
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_1_error_Watching_for_file_changes, errorCount), newLine, compilerOptions);
}
else {
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_0_errors, errorCount, errorCount), newLine, compilerOptions);
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_0_errors_Watching_for_file_changes, errorCount, errorCount), newLine, compilerOptions);
}
};
@ -644,7 +643,7 @@ namespace ts {
if (host.afterProgramCreate) {
host.afterProgramCreate(builderProgram);
}
reportWatchDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes);
return builderProgram;
}

View File

@ -130,8 +130,8 @@ namespace ts.tscWatch {
function createErrorsFoundCompilerDiagnostic(errors: ReadonlyArray<Diagnostic>) {
return errors.length === 1
? createCompilerDiagnostic(Diagnostics.Found_1_error)
: createCompilerDiagnostic(Diagnostics.Found_0_errors, errors.length);
? createCompilerDiagnostic(Diagnostics.Found_1_error_Watching_for_file_changes)
: createCompilerDiagnostic(Diagnostics.Found_0_errors_Watching_for_file_changes, errors.length);
}
function checkOutputErrorsInitial(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>, disableConsoleClears?: boolean, logsBeforeErrors?: string[]) {
@ -142,8 +142,7 @@ namespace ts.tscWatch {
logsBeforeErrors,
errors,
disableConsoleClears,
createErrorsFoundCompilerDiagnostic(errors),
createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
createErrorsFoundCompilerDiagnostic(errors));
}
function checkOutputErrorsIncremental(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>, disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) {
@ -154,8 +153,7 @@ namespace ts.tscWatch {
logsBeforeErrors,
errors,
disableConsoleClears,
createErrorsFoundCompilerDiagnostic(errors),
createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
createErrorsFoundCompilerDiagnostic(errors));
}
function checkOutputErrorsIncrementalWithExit(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>, expectedExitCode: ExitStatus, disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) {