Close watchers for TI that are no longer needed

This commit is contained in:
Sheetal Nandi committed 2025-05-16 14:31:50 -07:00
1 parent 3ae4463ad2
commit e89404fa2f
14 files changed
+684 -10

No files matched your search

+3 -1
View File
@@ -2023,9 +2023,11 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
else {
this.typeAcquisition = undefined;
}
// If the typeAcquition is disabled, dont use typing files as root
// If the typeAcquition is disabled, dont use typing files as root and close existing watchers from TI
if (!this.getTypeAcquisition().enable) {
const typingsCache = this.typingsCache;
this.updateTypingFiles(/*setTypings*/ undefined, /*newTypings*/ undefined, /*scheduleUpdate*/ false);
if (typingsCache) this.projectService.typingsInstaller.onProjectClosed(this);
}
}
+1 -1
View File
@@ -487,7 +487,7 @@ export abstract class TypingsInstaller {
const existing = this.projectWatchers.get(projectName);
const newSet = new Set(files);
if (!existing || forEachKey(newSet, s => !existing.has(s)) || forEachKey(existing, s => !newSet.has(s))) {
if (!existing || newSet.size !== existing.size || forEachKey(newSet, s => !existing.has(s)) || forEachKey(existing, s => !newSet.has(s))) {
this.projectWatchers.set(projectName, newSet);
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files });
}