This repository was archived by the owner on Nov 21, 2025. It is now read-only.
Commit 7b360f0
authored
fix(language-server): Ensure diagnostics are refreshed when language service gets enabled (#1669)
There is currently some amount magic that triggers diagnostics after the language service is enabled.
The mechanism that causes this to happen is ngcc. ngcc generates a lockfile named `__ngcc_lock_file__`
in the node_modules directory, this triggers the directory watcher,
and [ProjectsUpdatedInBackgroundEvent](https://github.com/angular/vscode-ng-language-service/blob/8c809a2982ccad19997caef7ffeaa899e9d8ddb5/server/src/session.ts#L491)
event is send by the method [delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles](https://github.com/microsoft/TypeScript/blob/56a4a93718ce016f038bcbce425bd3f47c3bec78/src/server/editorServices.ts#L1356).
But this [PR](angular/angular#44228) broke this.
Because the `.ngcc_lock_file` is [ignored by tsserver](https://github.com/microsoft/TypeScript/blob/ab2523bbe0352d4486f67b73473d2143ad64d03d/src/compiler/sys.ts#L500)
and the tsserver will [skip updating the project](https://github.com/microsoft/TypeScript/blob/56a4a93718ce016f038bcbce425bd3f47c3bec78/src/server/editorServices.ts#L1316).
When updating the integration project to use v14, the tests begin to fail:
https://app.circleci.com/pipelines/github/angular/vscode-ng-language-service/3585/workflows/40f00184-ea1e-441a-8af3-0fe5f017883f/jobs/3512
Instead of relying on magic/automatic triggering, this commit explictly requests that the
project refresh diagnostics after enabling the language service. In
fact, this change would have eventually been necessary when `ngcc` is no
longer run at all.
Special thanks to @ivanwonder for pinpointing the exact reasons for this
breakage: #1659 (comment)1 parent 8c809a2 commit 7b360f0
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
| 407 | + | |
407 | 408 | | |
408 | 409 | | |
409 | 410 | | |
| |||
0 commit comments