@@ -210,7 +210,7 @@ export class Session {
210210 const { configFileName} = this . projectService . openClientFile ( scriptInfo . fileName ) ;
211211 if ( ! configFileName ) {
212212 // Failed to find a config file. There is nothing we could do.
213- this . connection . console . error ( `No config file for ${ scriptInfo . fileName } ` ) ;
213+ this . error ( `No config file for ${ scriptInfo . fileName } ` ) ;
214214 return ;
215215 }
216216 project = this . projectService . findProject ( configFileName ) ;
@@ -270,7 +270,7 @@ export class Session {
270270 const { configFileName, configFileErrors} = result ;
271271 if ( configFileErrors && configFileErrors . length ) {
272272 // configFileErrors is an empty array even if there's no error, so check length.
273- this . connection . console . error ( configFileErrors . map ( e => e . messageText ) . join ( '\n' ) ) ;
273+ this . error ( configFileErrors . map ( e => e . messageText ) . join ( '\n' ) ) ;
274274 }
275275 if ( ! configFileName ) {
276276 // It is not really an error if there is no config file, because the
@@ -284,7 +284,7 @@ export class Session {
284284 }
285285 const project = this . projectService . findProject ( configFileName ) ;
286286 if ( ! project ) {
287- this . connection . console . error ( `Failed to find project for ${ filePath } ` ) ;
287+ this . error ( `Failed to find project for ${ filePath } ` ) ;
288288 return ;
289289 }
290290 if ( project . languageServiceEnabled ) {
@@ -319,7 +319,7 @@ export class Session {
319319 }
320320 const scriptInfo = this . projectService . getScriptInfo ( filePath ) ;
321321 if ( ! scriptInfo ) {
322- this . connection . console . log ( `Failed to get script info for ${ filePath } ` ) ;
322+ this . error ( `Failed to get script info for ${ filePath } ` ) ;
323323 return ;
324324 }
325325 for ( const change of contentChanges ) {
@@ -415,7 +415,7 @@ export class Session {
415415 const filePath = uriToFilePath ( textDocument . uri ) ;
416416 const scriptInfo = this . projectService . getScriptInfo ( filePath ) ;
417417 if ( ! scriptInfo ) {
418- this . connection . console . log ( `Script info not found for ${ filePath } ` ) ;
418+ this . error ( `Script info not found for ${ filePath } ` ) ;
419419 return ;
420420 }
421421
@@ -528,35 +528,31 @@ export class Session {
528528 const NG_CORE = '@angular/core/core.d.ts' ;
529529 const { projectName} = project ;
530530 if ( ! project . languageServiceEnabled ) {
531- const msg = `Language service is already disabled for ${ projectName } . ` +
531+ this . info (
532+ `Language service is already disabled for ${ projectName } . ` +
532533 `This could be due to non-TS files that exceeded the size limit (${
533- ts . server . maxProgramSizeForNonTsFiles } bytes).` +
534- `Please check log file for details.` ;
535- this . connection . console . info ( msg ) ; // log to remote console to inform users
536- project . log ( msg ) ; // log to file, so that it's easier to correlate with ts entries
534+ ts . server . maxProgramSizeForNonTsFiles } bytes).` +
535+ `Please check log file for details.` ) ;
537536
538537 return ;
539538 }
540539 if ( ! isAngularProject ( project , NG_CORE ) ) {
541540 project . disableLanguageService ( ) ;
542- const msg =
541+ this . info (
543542 `Disabling language service for ${ projectName } because it is not an Angular project ` +
544543 `('${ NG_CORE } ' could not be found). ` +
545- `If you believe you are seeing this message in error, please reinstall the packages in your package.json.` ;
546- this . connection . console . info ( msg ) ;
547- project . log ( msg ) ;
544+ `If you believe you are seeing this message in error, please reinstall the packages in your package.json.` ) ;
545+
548546 if ( project . getExcludedFiles ( ) . some ( f => f . endsWith ( NG_CORE ) ) ) {
549- const msg =
550- `Please check your tsconfig.json to make sure 'node_modules' directory is not excluded.` ;
551- this . connection . console . info ( msg ) ;
552- project . log ( msg ) ;
547+ this . info (
548+ `Please check your tsconfig.json to make sure 'node_modules' directory is not excluded.` ) ;
553549 }
554550
555551 return ;
556552 }
557553
558554 // The language service should be enabled at this point.
559- this . connection . console . info ( `Enabling language service for ${ projectName } .` ) ;
555+ this . info ( `Enabling language service for ${ projectName } .` ) ;
560556 }
561557}
562558
0 commit comments