No Watching

This commit is contained in:
Sheetal Nandi
2020-05-13 16:31:25 -07:00
parent 5726838a54
commit ffe50a3dc4
3 changed files with 12 additions and 5 deletions
+3 -2
View File
@@ -233,13 +233,14 @@ namespace ts {
}
export const noopFileWatcher: FileWatcher = { close: noop };
export const returnNoopFileWatcher = () => noopFileWatcher;
export function createWatchHost(system = sys, reportWatchStatus?: WatchStatusReporter): WatchHost {
const onWatchStatusChange = reportWatchStatus || createWatchStatusReporter(system);
return {
onWatchStatusChange,
watchFile: maybeBind(system, system.watchFile) || (() => noopFileWatcher),
watchDirectory: maybeBind(system, system.watchDirectory) || (() => noopFileWatcher),
watchFile: maybeBind(system, system.watchFile) || returnNoopFileWatcher,
watchDirectory: maybeBind(system, system.watchDirectory) || returnNoopFileWatcher,
setTimeout: maybeBind(system, system.setTimeout) || noop,
clearTimeout: maybeBind(system, system.clearTimeout) || noop
};
+7 -1
View File
@@ -724,7 +724,13 @@ namespace ts.server {
const watchLogLevel = this.logger.hasLevel(LogLevel.verbose) ? WatchLogLevel.Verbose :
this.logger.loggingEnabled() ? WatchLogLevel.TriggerOnly : WatchLogLevel.None;
const log: (s: string) => void = watchLogLevel !== WatchLogLevel.None ? (s => this.logger.info(s)) : noop;
this.watchFactory = getWatchFactory(watchLogLevel, log, getDetailWatchInfo);
this.watchFactory = this.syntaxOnly ?
{
watchFile: returnNoopFileWatcher,
watchFilePath: returnNoopFileWatcher,
watchDirectory: returnNoopFileWatcher,
} :
getWatchFactory(watchLogLevel, log, getDetailWatchInfo);
}
toPath(fileName: string) {
+2 -2
View File
@@ -947,7 +947,7 @@ namespace ts.server {
// update builder only if language service is enabled
// otherwise tell it to drop its internal state
if (this.languageServiceEnabled) {
if (this.languageServiceEnabled && !this.projectService.syntaxOnly) {
// 1. no changes in structure, no changes in unresolved imports - do nothing
// 2. no changes in structure, unresolved imports were changed - collect unresolved imports for all files
// (can reuse cached imports for files that were not changed)
@@ -1070,7 +1070,7 @@ namespace ts.server {
}
// Watch the type locations that would be added to program as part of automatic type resolutions
if (this.languageServiceEnabled) {
if (this.languageServiceEnabled && !this.projectService.syntaxOnly) {
this.resolutionCache.updateTypeRootsWatch();
}
}