Skip to content

Commit dd049ca

Browse files
ivanwonderAndrewKushnir
authored andcommitted
fix(language-service): disable update the @angular/core module (angular#36783)
After the user edits the file `core.d.ts`, the symbol from the core module will be invalided, which only is created when init the language service. Then the language-service will crash. PR Close angular#36783
1 parent bcd31cb commit dd049ca

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/language-service/src/typescript_host.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,14 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
217217

218218
// Check if any source files have been added / changed since last computation.
219219
const seen = new Set<string>();
220+
const ANGULAR_CORE = '@angular/core';
221+
const corePath = this.reflectorHost.moduleNameToFileName(ANGULAR_CORE);
220222
for (const {fileName} of program.getSourceFiles()) {
223+
// If the `@angular/core` has been edited, the language service should be restart,
224+
// so ignore the change of `@angular/core`.
225+
if (fileName === corePath) {
226+
continue;
227+
}
221228
seen.add(fileName);
222229
const version = this.tsLsHost.getScriptVersion(fileName);
223230
const lastVersion = this.fileVersions.get(fileName);

0 commit comments

Comments
 (0)