File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -802,17 +802,27 @@ module ts {
802802 return this . forwardJSONCall (
803803 "getTSConfigFileInfo('" + fileName + "')" ,
804804 ( ) => {
805- var text = sourceTextSnapshot . getText ( 0 , sourceTextSnapshot . getLength ( ) ) ;
806- var json = / \S / . test ( text ) ? JSON . parse ( text ) : { } ;
807-
808- var configFile = parseConfigFile ( json , this . host , getDirectoryPath ( normalizeSlashes ( fileName ) ) ) ;
809-
810- var realErrors = realizeDiagnostics ( configFile . errors , '\r\n' ) ;
805+ let text = sourceTextSnapshot . getText ( 0 , sourceTextSnapshot . getLength ( ) ) ;
806+
807+ try {
808+ var json = / \S / . test ( text ) ? JSON . parse ( text ) : { } ;
809+ }
810+ catch ( e ) {
811+ return {
812+ options : { } ,
813+ files : [ ] ,
814+ errors : realizeDiagnostic ( createCompilerDiagnostic ( Diagnostics . Unable_to_open_file_0 , fileName ) , '\r\n' )
815+ }
816+ }
817+
818+ if ( json ) {
819+ var configFile = parseConfigFile ( json , this . host , getDirectoryPath ( normalizeSlashes ( fileName ) ) ) ;
820+ }
811821
812822 return {
813823 options : configFile . options ,
814824 files : configFile . fileNames ,
815- errors : realErrors
825+ errors : realizeDiagnostics ( configFile . errors , '\r\n' )
816826 } ;
817827 } ) ;
818828 }
You can’t perform that action at this time.
0 commit comments