Handle resolution watching when its dynamic scriptInfo (#62894)

This commit is contained in:
Sheetal Nandi
2026-01-15 11:13:21 -08:00
committed by GitHub
parent a9f534f271
commit 4d94ccb06b
52 changed files with 443 additions and 2077 deletions

View File

@@ -1530,6 +1530,15 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
/** @internal */
watchTypingLocations(files: readonly string[] | undefined): void {
// Skip watching typing locations for inferred project whose currentDirectory is not watchable or
// is same as server's current directory
if (
this.currentDirectory === this.projectService.currentDirectory ||
!canWatchDirectoryOrFilePath(this.toPath(this.currentDirectory))
) {
return;
}
if (!files) {
this.typingWatchers!.isInvoked = false;
return;
@@ -1626,6 +1635,18 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
});
}
/** @internal */
skipWatchingFailedLookups(path: Path): boolean | undefined {
const info = this.projectService.getScriptInfoForPath(path);
return info?.isDynamic;
}
/** @internal */
skipWatchingTypeRoots(): boolean | undefined {
// Skip watching inferrd project where current directory is lib location
return isInferredProject(this) && this.currentDirectory === this.projectService.currentDirectory;
}
/** @internal */
getCurrentProgram(): Program | undefined {
return this.program;