fix(language-service): Recover from error in analyzing Ng Modules (#37108)

In place of failing to return analyzed Ng Modules when the analyzer
fails, return the previously-analyzed Ng Modules (which may be empty)
and log an error.

Closes https://github.com/angular/vscode-ng-language-service/issues/777

PR Close #37108
This commit is contained in:
Ayaz Hafiz
2020-05-14 08:35:38 -07:00
committed by atscott
parent 34827559b9
commit c4f4675ebf
3 changed files with 55 additions and 2 deletions

View File

@ -101,6 +101,7 @@ export class MockTypescriptHost implements ts.LanguageServiceHost {
private readonly overrideDirectory = new Set<string>();
private readonly existsCache = new Map<string, boolean>();
private readonly fileCache = new Map<string, string|undefined>();
errors: string[] = [];
constructor(
private readonly scriptNames: string[],
@ -398,6 +399,10 @@ export class MockTypescriptHost implements ts.LanguageServiceHost {
}
throw new Error(`Failed to find marker '${selector}' in ${fileName}`);
}
error(msg: string) {
this.errors.push(msg);
}
}
const locationMarker = /\~\{(\w+(-\w+)*)\}/g;