Do not watch tsconfig files from folders that we canot watch

Fixes #30818
This commit is contained in:
Sheetal Nandi
2019-06-07 10:10:48 -07:00
parent 737cb45780
commit a6c72a0cf3
10 changed files with 123 additions and 76 deletions

View File

@@ -1333,7 +1333,11 @@ namespace ts.server {
const watches: WatchType[] = [];
if (configFileExistenceInfo.configFileWatcherForRootOfInferredProject) {
watches.push(WatchType.ConfigFileForInferredRoot);
watches.push(
configFileExistenceInfo.configFileWatcherForRootOfInferredProject === noopFileWatcher ?
WatchType.NoopConfigFileForInferredRoot :
WatchType.ConfigFileForInferredRoot
);
}
if (this.configuredProjects.has(canonicalConfigFilePath)) {
watches.push(WatchType.ConfigFile);
@@ -1349,13 +1353,16 @@ namespace ts.server {
canonicalConfigFilePath: string,
configFileExistenceInfo: ConfigFileExistenceInfo
) {
configFileExistenceInfo.configFileWatcherForRootOfInferredProject = this.watchFactory.watchFile(
this.host,
configFileName,
(_filename, eventKind) => this.onConfigFileChangeForOpenScriptInfo(configFileName, eventKind),
PollingInterval.High,
WatchType.ConfigFileForInferredRoot
);
configFileExistenceInfo.configFileWatcherForRootOfInferredProject =
canWatchDirectory(getDirectoryPath(canonicalConfigFilePath) as Path) ?
this.watchFactory.watchFile(
this.host,
configFileName,
(_filename, eventKind) => this.onConfigFileChangeForOpenScriptInfo(configFileName, eventKind),
PollingInterval.High,
WatchType.ConfigFileForInferredRoot
) :
noopFileWatcher;
this.logConfigFileWatchUpdate(configFileName, canonicalConfigFilePath, configFileExistenceInfo, ConfigFileWatcherStatus.UpdatedCallback);
}

View File

@@ -226,5 +226,6 @@ namespace ts {
ConfigFileForInferredRoot = "Config file for the inferred project root",
NodeModulesForClosedScriptInfo = "node_modules for closed script infos in them",
MissingSourceMapFile = "Missing source map file",
NoopConfigFileForInferredRoot = "Noop Config file for the inferred project root",
}
}