Skip to content

Commit 5afc23e

Browse files
committed
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 (cherry picked from commit 5712ab8)
1 parent 7d04bb6 commit 5afc23e

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
@@ -1216,15 +1216,19 @@ export class Session {
12161216
// prioritized for that project's set of files. This will cause issues if the second project is,
12171217
// for example, one that only includes `*.spec.ts` files and not the entire set of files needed
12181218
// to compile the app (i.e. `*.module.ts`).
1219+
const enabledProjects = new Set<ts.server.Project>();
12191220
for (let i = 0; i < this.projectNgccQueue.length && this.projectNgccQueue[i].done; i++) {
12201221
// Re-enable language service even if ngcc fails, because users could fix
12211222
// the problem by running ngcc themselves. If we keep language service
12221223
// disabled, there's no way users could use the extension even after
12231224
// resolving ngcc issues. On the client side, we will warn users about
12241225
// potentially degraded experience.
1225-
this.enableLanguageServiceForProject(this.projectNgccQueue[i].project);
1226+
const p = this.projectNgccQueue[i].project;
1227+
this.enableLanguageServiceForProject(p);
1228+
enabledProjects.add(p);
12261229
}
1227-
this.projectNgccQueue = this.projectNgccQueue.filter(({done}) => !done);
1230+
this.projectNgccQueue =
1231+
this.projectNgccQueue.filter(({project}) => !enabledProjects.has(project));
12281232
}
12291233
}
12301234

0 commit comments

Comments
 (0)