@@ -133,11 +133,12 @@ export class Session {
133133 if ( ! scriptInfo ) {
134134 continue ;
135135 }
136- const project = this . projectService . getDefaultProjectForScriptInfo ( scriptInfo ) ;
137- if ( ! project || ! project . languageServiceEnabled ) {
136+
137+ const ngLS = this . projectService . getDefaultLanguageService ( scriptInfo ) ;
138+ if ( ! ngLS ) {
138139 continue ;
139140 }
140- const ngLS = project . getLanguageService ( ) ;
141+
141142 const diagnostics = ngLS . getSemanticDiagnostics ( fileName ) ;
142143 // Need to send diagnostics even if it's empty otherwise editor state will
143144 // not be updated.
@@ -269,13 +270,12 @@ export class Session {
269270 }
270271
271272 const { fileName} = scriptInfo ;
272- const project = this . projectService . getDefaultProjectForScriptInfo ( scriptInfo ) ;
273- if ( ! project || ! project . languageServiceEnabled ) {
273+ const langSvc = this . projectService . getDefaultLanguageService ( scriptInfo ) ;
274+ if ( ! langSvc ) {
274275 return ;
275276 }
276277
277278 const offset = lspPositionToTsPosition ( scriptInfo , position ) ;
278- const langSvc = project . getLanguageService ( ) ;
279279 const definition = langSvc . getDefinitionAndBoundSpan ( fileName , offset ) ;
280280 if ( ! definition || ! definition . definitions ) {
281281 return ;
@@ -316,12 +316,11 @@ export class Session {
316316 if ( ! scriptInfo ) {
317317 return ;
318318 }
319- const project = this . projectService . getDefaultProjectForScriptInfo ( scriptInfo ) ;
320- if ( ! project || ! project . languageServiceEnabled ) {
319+ const langSvc = this . projectService . getDefaultLanguageService ( scriptInfo ) ;
320+ if ( ! langSvc ) {
321321 return ;
322322 }
323323 const offset = lspPositionToTsPosition ( scriptInfo , position ) ;
324- const langSvc = project . getLanguageService ( ) ;
325324 const info = langSvc . getQuickInfoAtPosition ( scriptInfo . fileName , offset ) ;
326325 if ( ! info ) {
327326 return ;
@@ -361,12 +360,11 @@ export class Session {
361360 return ;
362361 }
363362 const { fileName} = scriptInfo ;
364- const project = this . projectService . getDefaultProjectForScriptInfo ( scriptInfo ) ;
365- if ( ! project || ! project . languageServiceEnabled ) {
363+ const langSvc = this . projectService . getDefaultLanguageService ( scriptInfo ) ;
364+ if ( ! langSvc ) {
366365 return ;
367366 }
368367 const offset = lspPositionToTsPosition ( scriptInfo , position ) ;
369- const langSvc = project . getLanguageService ( ) ;
370368 const completions = langSvc . getCompletionsAtPosition (
371369 fileName , offset ,
372370 {
0 commit comments