Skip to content

Commit ca53993

Browse files
authored
Merge pull request #23462 from JoshuaKGoldberg/combined-pretty-summaries
Combined "Found X error(s)" and "Compilation complete" --watch messages
2 parents e50b24a + 9dff614 commit ca53993

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

src/compiler/diagnosticMessages.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2943,10 +2943,6 @@
29432943
"category": "Message",
29442944
"code": 6040
29452945
},
2946-
"Compilation complete. Watching for file changes.": {
2947-
"category": "Message",
2948-
"code": 6042
2949-
},
29502946
"Generates corresponding '.map' file.": {
29512947
"category": "Message",
29522948
"code": 6043
@@ -3522,11 +3518,11 @@
35223518
"code": 6192,
35233519
"reportsUnnecessary": true
35243520
},
3525-
"Found 1 error.": {
3521+
"Found 1 error. Watching for file changes.": {
35263522
"category": "Message",
35273523
"code": 6193
35283524
},
3529-
"Found {0} errors.": {
3525+
"Found {0} errors. Watching for file changes.": {
35303526
"category": "Message",
35313527
"code": 6194
35323528
},

src/compiler/watch.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ namespace ts {
2929

3030
/** @internal */
3131
export const nonClearingMessageCodes: number[] = [
32-
Diagnostics.Compilation_complete_Watching_for_file_changes.code,
33-
Diagnostics.Found_1_error.code,
34-
Diagnostics.Found_0_errors.code
32+
Diagnostics.Found_1_error_Watching_for_file_changes.code,
33+
Diagnostics.Found_0_errors_Watching_for_file_changes.code
3534
];
3635

3736
function clearScreenIfNotWatchingForFileChanges(system: System, diagnostic: Diagnostic, options: CompilerOptions) {
@@ -231,10 +230,10 @@ namespace ts {
231230

232231
const reportSummary = (errorCount: number) => {
233232
if (errorCount === 1) {
234-
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_1_error, errorCount), newLine, compilerOptions);
233+
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_1_error_Watching_for_file_changes, errorCount), newLine, compilerOptions);
235234
}
236235
else {
237-
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_0_errors, errorCount, errorCount), newLine, compilerOptions);
236+
onWatchStatusChange(createCompilerDiagnostic(Diagnostics.Found_0_errors_Watching_for_file_changes, errorCount, errorCount), newLine, compilerOptions);
238237
}
239238
};
240239

@@ -644,7 +643,7 @@ namespace ts {
644643
if (host.afterProgramCreate) {
645644
host.afterProgramCreate(builderProgram);
646645
}
647-
reportWatchDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes);
646+
648647
return builderProgram;
649648
}
650649

src/harness/unittests/tscWatchMode.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ namespace ts.tscWatch {
130130

131131
function createErrorsFoundCompilerDiagnostic(errors: ReadonlyArray<Diagnostic>) {
132132
return errors.length === 1
133-
? createCompilerDiagnostic(Diagnostics.Found_1_error)
134-
: createCompilerDiagnostic(Diagnostics.Found_0_errors, errors.length);
133+
? createCompilerDiagnostic(Diagnostics.Found_1_error_Watching_for_file_changes)
134+
: createCompilerDiagnostic(Diagnostics.Found_0_errors_Watching_for_file_changes, errors.length);
135135
}
136136

137137
function checkOutputErrorsInitial(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>, disableConsoleClears?: boolean, logsBeforeErrors?: string[]) {
@@ -142,8 +142,7 @@ namespace ts.tscWatch {
142142
logsBeforeErrors,
143143
errors,
144144
disableConsoleClears,
145-
createErrorsFoundCompilerDiagnostic(errors),
146-
createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
145+
createErrorsFoundCompilerDiagnostic(errors));
147146
}
148147

149148
function checkOutputErrorsIncremental(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>, disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) {
@@ -154,8 +153,7 @@ namespace ts.tscWatch {
154153
logsBeforeErrors,
155154
errors,
156155
disableConsoleClears,
157-
createErrorsFoundCompilerDiagnostic(errors),
158-
createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
156+
createErrorsFoundCompilerDiagnostic(errors));
159157
}
160158

161159
function checkOutputErrorsIncrementalWithExit(host: WatchedSystem, errors: ReadonlyArray<Diagnostic>, expectedExitCode: ExitStatus, disableConsoleClears?: boolean, logsBeforeWatchDiagnostic?: string[], logsBeforeErrors?: string[]) {

0 commit comments

Comments
 (0)