Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7960090

Browse filesBrowse files
committed
Add preserveWatchOutput option to build option and report starting compilation and file changes detected status
1 parent dedb2ae commit 7960090
Copy full SHA for 7960090

2 files changed

+16-1Lines changed: 16 additions & 1 deletion

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/compiler/tsbuild.ts‎

Copy file name to clipboardExpand all lines: src/compiler/tsbuild.ts
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ namespace ts {
5454
/*@internal*/ clean?: boolean;
5555
/*@internal*/ watch?: boolean;
5656
/*@internal*/ help?: boolean;
57+
preserveWatchOutput?: boolean;
5758
}
5859

5960
enum BuildResultFlags {
@@ -465,6 +466,12 @@ namespace ts {
465466
host.reportSolutionBuilderStatus(createCompilerDiagnostic(message, ...args));
466467
}
467468

469+
function reportWatchStatus(message: DiagnosticMessage, ...args: string[]) {
470+
if (hostWithWatch.onWatchStatusChange) {
471+
hostWithWatch.onWatchStatusChange(createCompilerDiagnostic(message, ...args), host.getNewLine(), { preserveWatchOutput: context.options.preserveWatchOutput });
472+
}
473+
}
474+
468475
function startWatching() {
469476
const graph = getGlobalDependencyGraph()!;
470477
if (!graph.buildQueue) {
@@ -500,6 +507,7 @@ namespace ts {
500507
}
501508

502509
function invalidateProjectAndScheduleBuilds(resolved: ResolvedConfigFileName) {
510+
reportWatchStatus(Diagnostics.File_change_detected_Starting_incremental_compilation);
503511
invalidateProject(resolved);
504512
if (!hostWithWatch.setTimeout) {
505513
return;
@@ -1038,6 +1046,7 @@ namespace ts {
10381046
}
10391047

10401048
function buildAllProjects(): ExitStatus {
1049+
if (context.options.watch) { reportWatchStatus(Diagnostics.Starting_compilation_in_watch_mode); }
10411050
const graph = getGlobalDependencyGraph();
10421051
if (graph === undefined) return ExitStatus.DiagnosticsPresent_OutputsSkipped;
10431052

Collapse file

‎src/tsc/tsc.ts‎

Copy file name to clipboardExpand all lines: src/tsc/tsc.ts
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,13 @@ namespace ts {
211211
category: Diagnostics.Command_line_Options,
212212
description: Diagnostics.Watch_input_files,
213213
type: "boolean"
214-
}
214+
},
215+
{
216+
name: "preserveWatchOutput",
217+
type: "boolean",
218+
category: Diagnostics.Command_line_Options,
219+
description: Diagnostics.Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen,
220+
},
215221
];
216222
let buildOptionNameMap: OptionNameMap | undefined;
217223
const returnBuildOptionNameMap = () => (buildOptionNameMap || (buildOptionNameMap = createOptionNameMap(buildOpts)));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.