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:
Sheetal Nandi committed 2018-04-13 15:17:13 -07:00
1 parent c9479f7263
commit 35abe26824
3 files changed
+16 -5

No files matched your search

+7 -1
View File
@@ -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;
}
}