Skip to content

Commit 5712ab8

Browse files
authored
fix(server): Ensure all projects that finish ngcc re-enable language service features (#1627)
The implementation of the ngcc queue for re-enabling project language service's is incorrect. It unconditionally removes projects from the queue when the ngcc process finishes even if it finished out of order and is waiting for the first project in the queue to finish. This results in later projects never getting the language service re-enabled when the earlier project(s) finally finish ngcc. This fix works towards stabilizing the extension for solution-style projects. Related to #876
1 parent 3848142 commit 5712ab8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/src/session.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,15 +1232,19 @@ export class Session {
12321232
// prioritized for that project's set of files. This will cause issues if the second project is,
12331233
// for example, one that only includes `*.spec.ts` files and not the entire set of files needed
12341234
// to compile the app (i.e. `*.module.ts`).
1235+
const enabledProjects = new Set<ts.server.Project>();
12351236
for (let i = 0; i < this.projectNgccQueue.length && this.projectNgccQueue[i].done; i++) {
12361237
// Re-enable language service even if ngcc fails, because users could fix
12371238
// the problem by running ngcc themselves. If we keep language service
12381239
// disabled, there's no way users could use the extension even after
12391240
// resolving ngcc issues. On the client side, we will warn users about
12401241
// potentially degraded experience.
1241-
this.enableLanguageServiceForProject(this.projectNgccQueue[i].project);
1242+
const p = this.projectNgccQueue[i].project;
1243+
this.enableLanguageServiceForProject(p);
1244+
enabledProjects.add(p);
12421245
}
1243-
this.projectNgccQueue = this.projectNgccQueue.filter(({done}) => !done);
1246+
this.projectNgccQueue =
1247+
this.projectNgccQueue.filter(({project}) => !enabledProjects.has(project));
12441248
}
12451249
}
12461250

0 commit comments

Comments
 (0)