@@ -262,23 +262,12 @@ namespace FourSlash {
262
262
// Initialize the language service with all the scripts
263
263
let startResolveFileRef : FourSlashFile ;
264
264
265
+ let configFileName : string ;
265
266
ts . forEach ( testData . files , file => {
266
267
// Create map between fileName and its content for easily looking up when resolveReference flag is specified
267
268
this . inputFiles [ file . fileName ] = file . content ;
268
-
269
269
if ( ts . getBaseFileName ( file . fileName ) . toLowerCase ( ) === "tsconfig.json" ) {
270
- const configJson = ts . parseConfigFileTextToJson ( file . fileName , file . content ) ;
271
- assert . isTrue ( configJson . config !== undefined ) ;
272
-
273
- // Extend our existing compiler options so that we can also support tsconfig only options
274
- if ( configJson . config . compilerOptions ) {
275
- const baseDirectory = ts . normalizePath ( ts . getDirectoryPath ( file . fileName ) ) ;
276
- const tsConfig = ts . convertCompilerOptionsFromJson ( configJson . config . compilerOptions , baseDirectory , file . fileName ) ;
277
-
278
- if ( ! tsConfig . errors || ! tsConfig . errors . length ) {
279
- compilationOptions = ts . extend ( compilationOptions , tsConfig . options ) ;
280
- }
281
- }
270
+ configFileName = file . fileName ;
282
271
}
283
272
284
273
if ( ! startResolveFileRef && file . fileOptions [ metadataOptionNames . resolveReference ] === "true" ) {
@@ -290,6 +279,21 @@ namespace FourSlash {
290
279
}
291
280
} ) ;
292
281
282
+ if ( configFileName ) {
283
+ const baseDir = ts . normalizePath ( ts . getDirectoryPath ( configFileName ) ) ;
284
+ const host = new Utils . MockParseConfigHost ( baseDir , /*ignoreCase*/ false , this . inputFiles ) ;
285
+
286
+ const configJsonObj = ts . parseConfigFileTextToJson ( configFileName , this . inputFiles [ configFileName ] ) ;
287
+ assert . isTrue ( configJsonObj . config !== undefined ) ;
288
+
289
+ const { options, errors } = ts . parseJsonConfigFileContent ( configJsonObj . config , host , baseDir ) ;
290
+
291
+ // Extend our existing compiler options so that we can also support tsconfig only options
292
+ if ( ! errors || errors . length === 0 ) {
293
+ compilationOptions = ts . extend ( compilationOptions , options ) ;
294
+ }
295
+ }
296
+
293
297
294
298
if ( compilationOptions . typeRoots ) {
295
299
compilationOptions . typeRoots = compilationOptions . typeRoots . map ( p => ts . getNormalizedAbsolutePath ( p , this . basePath ) ) ;
0 commit comments