fix(language-service): disable update the `@angular/core` module (#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 #36783
This commit is contained in:
ivanwonder 2020-04-24 10:45:31 +08:00 committed by Andrew Kushnir
parent bcd31cb857
commit dd049caf0a
1 changed files with 7 additions and 0 deletions

View File

@ -217,7 +217,14 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
// Check if any source files have been added / changed since last computation.
const seen = new Set<string>();
const ANGULAR_CORE = '@angular/core';
const corePath = this.reflectorHost.moduleNameToFileName(ANGULAR_CORE);
for (const {fileName} of program.getSourceFiles()) {
// If the `@angular/core` has been edited, the language service should be restart,
// so ignore the change of `@angular/core`.
if (fileName === corePath) {
continue;
}
seen.add(fileName);
const version = this.tsLsHost.getScriptVersion(fileName);
const lastVersion = this.fileVersions.get(fileName);