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

This commit is contained in:
Sheetal Nandi 2018-08-20 14:22:58 -07:00
parent dedb2aefc0
commit 7960090bb6
2 changed files with 16 additions and 1 deletions

View file

@ -54,6 +54,7 @@ namespace ts {
/*@internal*/ clean?: boolean;
/*@internal*/ watch?: boolean;
/*@internal*/ help?: boolean;
preserveWatchOutput?: boolean;
}
enum BuildResultFlags {
@ -465,6 +466,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) {
@ -500,6 +507,7 @@ namespace ts {
}
function invalidateProjectAndScheduleBuilds(resolved: ResolvedConfigFileName) {
reportWatchStatus(Diagnostics.File_change_detected_Starting_incremental_compilation);
invalidateProject(resolved);
if (!hostWithWatch.setTimeout) {
return;
@ -1038,6 +1046,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;

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)));