@@ -97,6 +97,30 @@ var x = 10;`
97
97
checkProjectActualFiles ( service . configuredProjects . get ( config . path ) ! , [ untitled . path , libFile . path , config . path ] ) ;
98
98
checkProjectActualFiles ( service . inferredProjects [ 0 ] , [ untitledFile , libFile . path ] ) ;
99
99
} ) ;
100
+
101
+ it ( "opening and closing untitled files when projectRootPath is different from currentDirectory" , ( ) => {
102
+ const config : File = {
103
+ path : `${ tscWatch . projectRoot } /tsconfig.json` ,
104
+ content : "{}"
105
+ } ;
106
+ const file : File = {
107
+ path : `${ tscWatch . projectRoot } /file.ts` ,
108
+ content : "const y = 10"
109
+ } ;
110
+ const host = createServerHost ( [ config , file , libFile ] , { useCaseSensitiveFileNames : true } ) ;
111
+ const service = createProjectService ( host , /*parameters*/ undefined , { useInferredProjectPerProjectRoot : true } ) ;
112
+ service . openClientFile ( untitledFile , "const x = 10;" , /*scriptKind*/ undefined , tscWatch . projectRoot ) ;
113
+ checkNumberOfProjects ( service , { inferredProjects : 1 } ) ;
114
+ checkProjectActualFiles ( service . inferredProjects [ 0 ] , [ untitledFile , libFile . path ] ) ;
115
+ verifyDynamic ( service , `${ tscWatch . projectRoot } /${ untitledFile } ` ) ;
116
+
117
+ // Close untitled file
118
+ service . closeClientFile ( untitledFile ) ;
119
+
120
+ // Open file from configured project which should collect inferredProject
121
+ service . openClientFile ( file . path ) ;
122
+ checkNumberOfProjects ( service , { configuredProjects : 1 } ) ;
123
+ } ) ;
100
124
} ) ;
101
125
102
126
describe ( "unittests:: tsserver:: dynamicFiles:: " , ( ) => {
0 commit comments