1
1
namespace ts . projectSystem {
2
2
import CommandNames = server . CommandNames ;
3
- const nullCancellationToken = server . nullCancellationToken ;
4
-
5
3
function createTestTypingsInstaller ( host : server . ServerHost ) {
6
4
return new TestTypingsInstaller ( "/a/data/" , /*throttleLimit*/ 5 , host ) ;
7
5
}
@@ -27,21 +25,6 @@ namespace ts.projectSystem {
27
25
}
28
26
}
29
27
30
- function createSession ( host : server . ServerHost , typingsInstaller ?: server . ITypingsInstaller ) : server . Session {
31
- const opts : server . SessionOptions = {
32
- host,
33
- cancellationToken : nullCancellationToken ,
34
- useSingleInferredProject : false ,
35
- useInferredProjectPerProjectRoot : false ,
36
- typingsInstaller : typingsInstaller || server . nullTypingsInstaller ,
37
- byteLength : Utils . byteLength ,
38
- hrtime : process . hrtime ,
39
- logger : createHasErrorMessageLogger ( ) . logger ,
40
- canUseEvents : false
41
- } ;
42
- return new server . Session ( opts ) ;
43
- }
44
-
45
28
describe ( "for configured projects" , ( ) => {
46
29
let moduleFile1 : File ;
47
30
let file1Consumer1 : File ;
@@ -113,7 +96,7 @@ namespace ts.projectSystem {
113
96
it ( "should contains only itself if a module file's shape didn't change, and all files referencing it if its shape changed" , ( ) => {
114
97
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , file1Consumer2 , globalFile3 , moduleFile2 , configFile , libFile ] ) ;
115
98
const typingsInstaller = createTestTypingsInstaller ( host ) ;
116
- const session = createSession ( host , typingsInstaller ) ;
99
+ const session = createSession ( host , { typingsInstaller } ) ;
117
100
118
101
openFilesForSession ( [ moduleFile1 , file1Consumer1 ] , session ) ;
119
102
@@ -138,7 +121,7 @@ namespace ts.projectSystem {
138
121
it ( "should be up-to-date with the reference map changes" , ( ) => {
139
122
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , file1Consumer2 , globalFile3 , moduleFile2 , configFile , libFile ] ) ;
140
123
const typingsInstaller = createTestTypingsInstaller ( host ) ;
141
- const session = createSession ( host , typingsInstaller ) ;
124
+ const session = createSession ( host , { typingsInstaller } ) ;
142
125
143
126
openFilesForSession ( [ moduleFile1 , file1Consumer1 ] , session ) ;
144
127
@@ -185,7 +168,7 @@ namespace ts.projectSystem {
185
168
it ( "should be up-to-date with changes made in non-open files" , ( ) => {
186
169
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , file1Consumer2 , globalFile3 , moduleFile2 , configFile , libFile ] ) ;
187
170
const typingsInstaller = createTestTypingsInstaller ( host ) ;
188
- const session = createSession ( host , typingsInstaller ) ;
171
+ const session = createSession ( host , { typingsInstaller } ) ;
189
172
190
173
openFilesForSession ( [ moduleFile1 ] , session ) ;
191
174
@@ -201,7 +184,7 @@ namespace ts.projectSystem {
201
184
it ( "should be up-to-date with deleted files" , ( ) => {
202
185
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , file1Consumer2 , globalFile3 , moduleFile2 , configFile , libFile ] ) ;
203
186
const typingsInstaller = createTestTypingsInstaller ( host ) ;
204
- const session = createSession ( host , typingsInstaller ) ;
187
+ const session = createSession ( host , { typingsInstaller } ) ;
205
188
206
189
openFilesForSession ( [ moduleFile1 ] , session ) ;
207
190
sendAffectedFileRequestAndCheckResult ( session , moduleFile1FileListRequest , [ { projectFileName : configFile . path , files : [ moduleFile1 , file1Consumer1 , file1Consumer2 ] } ] ) ;
@@ -215,7 +198,7 @@ namespace ts.projectSystem {
215
198
it ( "should be up-to-date with newly created files" , ( ) => {
216
199
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , file1Consumer2 , globalFile3 , moduleFile2 , configFile , libFile ] ) ;
217
200
const typingsInstaller = createTestTypingsInstaller ( host ) ;
218
- const session = createSession ( host , typingsInstaller ) ;
201
+ const session = createSession ( host , { typingsInstaller } ) ;
219
202
220
203
openFilesForSession ( [ moduleFile1 ] , session ) ;
221
204
sendAffectedFileRequestAndCheckResult ( session , moduleFile1FileListRequest , [ { projectFileName : configFile . path , files : [ moduleFile1 , file1Consumer1 , file1Consumer2 ] } ] ) ;
@@ -251,7 +234,7 @@ namespace ts.projectSystem {
251
234
252
235
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , configFile , libFile ] ) ;
253
236
const typingsInstaller = createTestTypingsInstaller ( host ) ;
254
- const session = createSession ( host , typingsInstaller ) ;
237
+ const session = createSession ( host , { typingsInstaller } ) ;
255
238
256
239
openFilesForSession ( [ moduleFile1 , file1Consumer1 ] , session ) ;
257
240
sendAffectedFileRequestAndCheckResult ( session , moduleFile1FileListRequest , [ { projectFileName : configFile . path , files : [ moduleFile1 , file1Consumer1 ] } ] ) ;
@@ -268,7 +251,7 @@ namespace ts.projectSystem {
268
251
it ( "should return all files if a global file changed shape" , ( ) => {
269
252
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , file1Consumer2 , globalFile3 , moduleFile2 , configFile , libFile ] ) ;
270
253
const typingsInstaller = createTestTypingsInstaller ( host ) ;
271
- const session = createSession ( host , typingsInstaller ) ;
254
+ const session = createSession ( host , { typingsInstaller } ) ;
272
255
273
256
openFilesForSession ( [ globalFile3 ] , session ) ;
274
257
const changeGlobalFile3ShapeRequest = makeSessionRequest < server . protocol . ChangeRequestArgs > ( CommandNames . Change , {
@@ -294,7 +277,7 @@ namespace ts.projectSystem {
294
277
295
278
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , file1Consumer2 , configFile , libFile ] ) ;
296
279
const typingsInstaller = createTestTypingsInstaller ( host ) ;
297
- const session = createSession ( host , typingsInstaller ) ;
280
+ const session = createSession ( host , { typingsInstaller } ) ;
298
281
openFilesForSession ( [ moduleFile1 ] , session ) ;
299
282
sendAffectedFileRequestAndCheckResult ( session , moduleFile1FileListRequest , [ ] ) ;
300
283
} ) ;
@@ -312,7 +295,7 @@ namespace ts.projectSystem {
312
295
313
296
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , file1Consumer2 , configFile , libFile ] ) ;
314
297
const typingsInstaller = createTestTypingsInstaller ( host ) ;
315
- const session = createSession ( host , typingsInstaller ) ;
298
+ const session = createSession ( host , { typingsInstaller } ) ;
316
299
openFilesForSession ( [ moduleFile1 ] , session ) ;
317
300
sendAffectedFileRequestAndCheckResult ( session , moduleFile1FileListRequest , [ ] ) ;
318
301
} ) ;
@@ -334,7 +317,7 @@ namespace ts.projectSystem {
334
317
335
318
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , file1Consumer2 , configFile2 , configFile , libFile ] ) ;
336
319
const typingsInstaller = createTestTypingsInstaller ( host ) ;
337
- const session = createSession ( host , typingsInstaller ) ;
320
+ const session = createSession ( host , { typingsInstaller } ) ;
338
321
339
322
openFilesForSession ( [ moduleFile1 , file1Consumer1 ] , session ) ;
340
323
sendAffectedFileRequestAndCheckResult ( session , moduleFile1FileListRequest , [ { projectFileName : configFile . path , files : [ moduleFile1 , file1Consumer1 , file1Consumer2 ] } ] ) ;
@@ -353,7 +336,7 @@ namespace ts.projectSystem {
353
336
354
337
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , configFile , libFile ] ) ;
355
338
const typingsInstaller = createTestTypingsInstaller ( host ) ;
356
- const session = createSession ( host , typingsInstaller ) ;
339
+ const session = createSession ( host , { typingsInstaller } ) ;
357
340
openFilesForSession ( [ moduleFile1 ] , session ) ;
358
341
359
342
const file1ChangeShapeRequest = makeSessionRequest < server . protocol . ChangeRequestArgs > ( CommandNames . Change , {
@@ -382,7 +365,7 @@ namespace ts.projectSystem {
382
365
383
366
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , configFile , libFile ] ) ;
384
367
const typingsInstaller = createTestTypingsInstaller ( host ) ;
385
- const session = createSession ( host , typingsInstaller ) ;
368
+ const session = createSession ( host , { typingsInstaller } ) ;
386
369
openFilesForSession ( [ moduleFile1 ] , session ) ;
387
370
388
371
const file1ChangeShapeRequest = makeSessionRequest < server . protocol . ChangeRequestArgs > ( CommandNames . Change , {
@@ -404,7 +387,7 @@ namespace ts.projectSystem {
404
387
} ;
405
388
const host = createServerHost ( [ moduleFile1 , file1Consumer1 , file1Consumer1Consumer1 , globalFile3 , configFile , libFile ] ) ;
406
389
const typingsInstaller = createTestTypingsInstaller ( host ) ;
407
- const session = createSession ( host , typingsInstaller ) ;
390
+ const session = createSession ( host , { typingsInstaller } ) ;
408
391
409
392
openFilesForSession ( [ moduleFile1 , file1Consumer1 ] , session ) ;
410
393
sendAffectedFileRequestAndCheckResult ( session , moduleFile1FileListRequest , [ { projectFileName : configFile . path , files : [ moduleFile1 , file1Consumer1 , file1Consumer1Consumer1 ] } ] ) ;
@@ -437,7 +420,7 @@ namespace ts.projectSystem {
437
420
} ;
438
421
const host = createServerHost ( [ file1 , file2 , configFile ] ) ;
439
422
const typingsInstaller = createTestTypingsInstaller ( host ) ;
440
- const session = createSession ( host , typingsInstaller ) ;
423
+ const session = createSession ( host , { typingsInstaller } ) ;
441
424
442
425
openFilesForSession ( [ file1 , file2 ] , session ) ;
443
426
const file1AffectedListRequest = makeSessionRequest < server . protocol . FileRequestArgs > ( CommandNames . CompileOnSaveAffectedFileList , { file : file1 . path } ) ;
@@ -520,7 +503,7 @@ namespace ts.projectSystem {
520
503
} )
521
504
} ;
522
505
const host = createServerHost ( [ dtsFile , f2 , config ] ) ;
523
- const session = projectSystem . createSession ( host ) ;
506
+ const session = createSession ( host ) ;
524
507
session . executeCommand ( {
525
508
seq : 1 ,
526
509
type : "request" ,
@@ -626,7 +609,7 @@ namespace ts.projectSystem {
626
609
} )
627
610
} ;
628
611
const host = createServerHost ( [ f1 , f2 , config ] ) ;
629
- const session = projectSystem . createSession ( host ) ;
612
+ const session = createSession ( host ) ;
630
613
session . executeCommand ( {
631
614
seq : 1 ,
632
615
type : "request" ,
0 commit comments