Skip to content

Commit

Permalink
fix: ensure project language service is the Angular LS
Browse files Browse the repository at this point in the history
Add check to ensure the returned language service for the project is the Angular
Language Service. This removes the need for a type assertion and also prevents
the native TS LS from taking the place of ours if there is an issue with the
plugin registration (which would result in duplicate results in TS files).

Fixes #1110.
  • Loading branch information
atscott committed Feb 16, 2021
1 parent 2a7e42c commit 9c4f757
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,12 @@ export class Session {
this.logger.info(`Failed to get language service for closed project ${project.projectName}.`);
return undefined;
}
const languageService = project.getLanguageService();
if (!('getTcb' in languageService)) {
return undefined;
}
return {
languageService: project.getLanguageService() as NgLanguageService,
languageService,
scriptInfo,
};
}
Expand Down

0 comments on commit 9c4f757

Please sign in to comment.