mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 22:32:33 -05:00
Force new typings resolution only if there are more or less script infos in the project.
This helps in reducing number of forced typing installation requests We anyways use changes in unresolved import array to determine if we need to enqueue new typing request Hence there is no need to soley rely on hasChanges from updateGraph which just indicates that we didnt reused the program (that does not mean new files were added to the program or changes in unresolved imports)
This commit is contained in:
@@ -92,6 +92,8 @@ namespace ts.server {
|
||||
cachedUnresolvedImportsPerFile = createMap<ReadonlyArray<string>>();
|
||||
/*@internal*/
|
||||
lastCachedUnresolvedImportsList: SortedReadonlyArray<string>;
|
||||
/*@internal*/
|
||||
hasMoreOrLessScriptInfos = false;
|
||||
|
||||
private lastFileExceededProgramSize: string | undefined;
|
||||
|
||||
@@ -777,6 +779,8 @@ namespace ts.server {
|
||||
this.resolutionCache.startRecordingFilesWithChangedResolutions();
|
||||
|
||||
let hasChanges = this.updateGraphWorker();
|
||||
const hasMoreOrLessScriptInfos = this.hasMoreOrLessScriptInfos;
|
||||
this.hasMoreOrLessScriptInfos = false;
|
||||
|
||||
const changedFiles: ReadonlyArray<Path> = this.resolutionCache.finishRecordingFilesWithChangedResolutions() || emptyArray;
|
||||
|
||||
@@ -803,7 +807,7 @@ namespace ts.server {
|
||||
this.lastCachedUnresolvedImportsList = toDeduplicatedSortedArray(result);
|
||||
}
|
||||
|
||||
const cachedTypings = this.projectService.typingsCache.getTypingsForProject(this, this.lastCachedUnresolvedImportsList, hasChanges);
|
||||
const cachedTypings = this.projectService.typingsCache.getTypingsForProject(this, this.lastCachedUnresolvedImportsList, hasMoreOrLessScriptInfos);
|
||||
if (!arrayIsEqualTo(this.typingFiles, cachedTypings)) {
|
||||
this.typingFiles = cachedTypings;
|
||||
this.markAsDirty();
|
||||
|
||||
@@ -304,6 +304,7 @@ namespace ts.server {
|
||||
const isNew = !this.isAttached(project);
|
||||
if (isNew) {
|
||||
this.containingProjects.push(project);
|
||||
project.hasMoreOrLessScriptInfos = true;
|
||||
if (!project.getCompilerOptions().preserveSymlinks) {
|
||||
this.ensureRealPath();
|
||||
}
|
||||
@@ -328,19 +329,24 @@ namespace ts.server {
|
||||
return;
|
||||
case 1:
|
||||
if (this.containingProjects[0] === project) {
|
||||
project.hasMoreOrLessScriptInfos = true;
|
||||
this.containingProjects.pop();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (this.containingProjects[0] === project) {
|
||||
project.hasMoreOrLessScriptInfos = true;
|
||||
this.containingProjects[0] = this.containingProjects.pop();
|
||||
}
|
||||
else if (this.containingProjects[1] === project) {
|
||||
project.hasMoreOrLessScriptInfos = true;
|
||||
this.containingProjects.pop();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
unorderedRemoveItem(this.containingProjects, project);
|
||||
if (unorderedRemoveItem(this.containingProjects, project)) {
|
||||
project.hasMoreOrLessScriptInfos = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user