@@ -1314,6 +1314,109 @@ namespace ts.projectSystem {
13141314
13151315 } ) ;
13161316
1317+ describe ( "ignoreConfigFiles" , ( ) => {
1318+ it ( "external project including config file" , ( ) => {
1319+ const file1 = {
1320+ path : "/a/b/f1.ts" ,
1321+ content : "let x =1;"
1322+ } ;
1323+ const config1 = {
1324+ path : "/a/b/tsconfig.json" ,
1325+ content : JSON . stringify (
1326+ {
1327+ compilerOptions : { } ,
1328+ files : [ "f1.ts" ]
1329+ }
1330+ )
1331+ } ;
1332+
1333+ const externalProjectName = "externalproject" ;
1334+ const host = createServerHost ( [ file1 , config1 ] ) ;
1335+ const projectService = createProjectService ( host , { useSingleInferredProject : true } , { syntaxOnly : true } ) ;
1336+ projectService . openExternalProject ( {
1337+ rootFiles : toExternalFiles ( [ file1 . path , config1 . path ] ) ,
1338+ options : { } ,
1339+ projectFileName : externalProjectName
1340+ } ) ;
1341+
1342+ checkNumberOfProjects ( projectService , { externalProjects : 1 } ) ;
1343+ const proj = projectService . externalProjects [ 0 ] ;
1344+ assert . isDefined ( proj ) ;
1345+
1346+ assert . isTrue ( proj . fileExists ( file1 . path ) ) ;
1347+ } ) ;
1348+
1349+ it ( "loose file included in config file (openClientFile)" , ( ) => {
1350+ const file1 = {
1351+ path : "/a/b/f1.ts" ,
1352+ content : "let x =1;"
1353+ } ;
1354+ const config1 = {
1355+ path : "/a/b/tsconfig.json" ,
1356+ content : JSON . stringify (
1357+ {
1358+ compilerOptions : { } ,
1359+ files : [ "f1.ts" ]
1360+ }
1361+ )
1362+ } ;
1363+
1364+ const host = createServerHost ( [ file1 , config1 ] ) ;
1365+ const projectService = createProjectService ( host , { useSingleInferredProject : true } , { syntaxOnly : true } ) ;
1366+ projectService . openClientFile ( file1 . path , file1 . content ) ;
1367+
1368+ checkNumberOfProjects ( projectService , { inferredProjects : 1 } ) ;
1369+ const proj = projectService . inferredProjects [ 0 ] ;
1370+ assert . isDefined ( proj ) ;
1371+
1372+ assert . isTrue ( proj . fileExists ( file1 . path ) ) ;
1373+ } ) ;
1374+
1375+ it ( "loose file included in config file (applyCodeChanges)" , ( ) => {
1376+ const file1 = {
1377+ path : "/a/b/f1.ts" ,
1378+ content : "let x =1;"
1379+ } ;
1380+ const config1 = {
1381+ path : "/a/b/tsconfig.json" ,
1382+ content : JSON . stringify (
1383+ {
1384+ compilerOptions : { } ,
1385+ files : [ "f1.ts" ]
1386+ }
1387+ )
1388+ } ;
1389+
1390+ const host = createServerHost ( [ file1 , config1 ] ) ;
1391+ const projectService = createProjectService ( host , { useSingleInferredProject : true } , { syntaxOnly : true } ) ;
1392+ projectService . applyChangesInOpenFiles ( [ { fileName : file1 . path , content : file1 . content } ] , [ ] , [ ] ) ;
1393+
1394+ checkNumberOfProjects ( projectService , { inferredProjects : 1 } ) ;
1395+ const proj = projectService . inferredProjects [ 0 ] ;
1396+ assert . isDefined ( proj ) ;
1397+
1398+ assert . isTrue ( proj . fileExists ( file1 . path ) ) ;
1399+ } ) ;
1400+ } ) ;
1401+
1402+ it ( "disable inferred project" , ( ) => {
1403+ const file1 = {
1404+ path : "/a/b/f1.ts" ,
1405+ content : "let x =1;"
1406+ } ;
1407+
1408+ const host = createServerHost ( [ file1 ] ) ;
1409+ const projectService = createProjectService ( host , { useSingleInferredProject : true } , { syntaxOnly : true } ) ;
1410+
1411+ projectService . openClientFile ( file1 . path , file1 . content ) ;
1412+
1413+ checkNumberOfProjects ( projectService , { inferredProjects : 1 } ) ;
1414+ const proj = projectService . inferredProjects [ 0 ] ;
1415+ assert . isDefined ( proj ) ;
1416+
1417+ assert . isFalse ( proj . languageServiceEnabled ) ;
1418+ } ) ;
1419+
13171420 it ( "reload regular file after closing" , ( ) => {
13181421 const f1 = {
13191422 path : "/a/b/app.ts" ,
0 commit comments