Add preserveWatchOutput option to build option and report starting compilation and file changes detected status

This commit is contained in:
Sheetal Nandi
2018-08-28 12:09:51 -07:00
parent 4570d97bf8
commit 8d7df0af03
2 changed files with 16 additions and 1 deletions
+9
View File
@@ -53,6 +53,7 @@ namespace ts {
/*@internal*/ clean?: boolean;
/*@internal*/ watch?: boolean;
/*@internal*/ help?: boolean;
preserveWatchOutput?: boolean;
}
enum BuildResultFlags {
@@ -464,6 +465,12 @@ namespace ts {
host.reportSolutionBuilderStatus(createCompilerDiagnostic(message, ...args));
}
function reportWatchStatus(message: DiagnosticMessage, ...args: string[]) {
if (hostWithWatch.onWatchStatusChange) {
hostWithWatch.onWatchStatusChange(createCompilerDiagnostic(message, ...args), host.getNewLine(), { preserveWatchOutput: context.options.preserveWatchOutput });
}
}
function startWatching() {
const graph = getGlobalDependencyGraph()!;
if (!graph.buildQueue) {
@@ -499,6 +506,7 @@ namespace ts {
}
function invalidateProjectAndScheduleBuilds(resolved: ResolvedConfigFileName) {
reportWatchStatus(Diagnostics.File_change_detected_Starting_incremental_compilation);
invalidateProject(resolved);
if (!hostWithWatch.setTimeout) {
return;
@@ -1037,6 +1045,7 @@ namespace ts {
}
function buildAllProjects(): ExitStatus {
if (context.options.watch) { reportWatchStatus(Diagnostics.Starting_compilation_in_watch_mode); }
const graph = getGlobalDependencyGraph();
if (graph === undefined) return ExitStatus.DiagnosticsPresent_OutputsSkipped;
+7 -1
View File
@@ -211,7 +211,13 @@ namespace ts {
category: Diagnostics.Command_line_Options,
description: Diagnostics.Watch_input_files,
type: "boolean"
}
},
{
name: "preserveWatchOutput",
type: "boolean",
category: Diagnostics.Command_line_Options,
description: Diagnostics.Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen,
},
];
let buildOptionNameMap: OptionNameMap | undefined;
const returnBuildOptionNameMap = () => (buildOptionNameMap || (buildOptionNameMap = createOptionNameMap(buildOpts)));