@@ -39,22 +39,22 @@ describe("unittests:: tsserver:: cancellationToken", () => {
39
39
const session = createSession ( host , { cancellationToken } ) ;
40
40
41
41
expectedRequestId = session . getNextSeq ( ) ;
42
- session . executeCommandSeq ( {
43
- command : "open" ,
42
+ session . executeCommandSeq < ts . server . protocol . OpenRequest > ( {
43
+ command : ts . server . protocol . CommandTypes . Open ,
44
44
arguments : { file : f1 . path }
45
- } as ts . server . protocol . OpenRequest ) ;
45
+ } ) ;
46
46
47
47
expectedRequestId = session . getNextSeq ( ) ;
48
- session . executeCommandSeq ( {
49
- command : "geterr" ,
50
- arguments : { files : [ f1 . path ] }
51
- } as ts . server . protocol . GeterrRequest ) ;
48
+ session . executeCommandSeq < ts . server . protocol . GeterrRequest > ( {
49
+ command : ts . server . protocol . CommandTypes . Geterr ,
50
+ arguments : { files : [ f1 . path ] , delay : 0 }
51
+ } ) ;
52
52
53
53
expectedRequestId = session . getNextSeq ( ) ;
54
- session . executeCommandSeq ( {
55
- command : "occurrences" ,
54
+ session . executeCommandSeq < ts . server . protocol . OccurrencesRequest > ( {
55
+ command : ts . server . protocol . CommandTypes . Occurrences ,
56
56
arguments : { file : f1 . path , line : 1 , offset : 6 }
57
- } as ts . server . protocol . OccurrencesRequest ) ;
57
+ } ) ;
58
58
59
59
expectedRequestId = 2 ;
60
60
host . runQueuedImmediateCallbacks ( ) ;
@@ -82,15 +82,15 @@ describe("unittests:: tsserver:: cancellationToken", () => {
82
82
cancellationToken
83
83
} ) ;
84
84
{
85
- session . executeCommandSeq ( {
86
- command : "open" ,
85
+ session . executeCommandSeq < ts . server . protocol . OpenRequest > ( {
86
+ command : ts . server . protocol . CommandTypes . Open ,
87
87
arguments : { file : f1 . path }
88
- } as ts . server . protocol . OpenRequest ) ;
88
+ } ) ;
89
89
// send geterr for missing file
90
- session . executeCommandSeq ( {
91
- command : "geterr" ,
92
- arguments : { files : [ "/a/missing" ] }
93
- } as ts . server . protocol . GeterrRequest ) ;
90
+ session . executeCommandSeq < ts . server . protocol . GeterrRequest > ( {
91
+ command : ts . server . protocol . CommandTypes . Geterr ,
92
+ arguments : { files : [ "/a/missing" ] , delay : 0 }
93
+ } ) ;
94
94
// Queued files
95
95
assert . equal ( host . getOutput ( ) . length , 0 , "expected 0 message" ) ;
96
96
host . checkTimeoutQueueLengthAndRun ( 1 ) ;
@@ -101,18 +101,18 @@ describe("unittests:: tsserver:: cancellationToken", () => {
101
101
{
102
102
const getErrId = session . getNextSeq ( ) ;
103
103
// send geterr for a valid file
104
- session . executeCommandSeq ( {
105
- command : "geterr" ,
106
- arguments : { files : [ f1 . path ] }
107
- } as ts . server . protocol . GeterrRequest ) ;
104
+ session . executeCommandSeq < ts . server . protocol . GeterrRequest > ( {
105
+ command : ts . server . protocol . CommandTypes . Geterr ,
106
+ arguments : { files : [ f1 . path ] , delay : 0 }
107
+ } ) ;
108
108
109
109
assert . equal ( host . getOutput ( ) . length , 0 , "expect 0 messages" ) ;
110
110
111
111
// run new request
112
- session . executeCommandSeq ( {
113
- command : "projectInfo" ,
114
- arguments : { file : f1 . path }
115
- } as ts . server . protocol . ProjectInfoRequest ) ;
112
+ session . executeCommandSeq < ts . server . protocol . ProjectInfoRequest > ( {
113
+ command : ts . server . protocol . CommandTypes . ProjectInfo ,
114
+ arguments : { file : f1 . path , needFileNameList : false }
115
+ } ) ;
116
116
session . clearMessages ( ) ;
117
117
118
118
// cancel previously issued Geterr
@@ -126,10 +126,10 @@ describe("unittests:: tsserver:: cancellationToken", () => {
126
126
}
127
127
{
128
128
const getErrId = session . getNextSeq ( ) ;
129
- session . executeCommandSeq ( {
130
- command : "geterr" ,
131
- arguments : { files : [ f1 . path ] }
132
- } as ts . server . protocol . GeterrRequest ) ;
129
+ session . executeCommandSeq < ts . server . protocol . GeterrRequest > ( {
130
+ command : ts . server . protocol . CommandTypes . Geterr ,
131
+ arguments : { files : [ f1 . path ] , delay : 0 }
132
+ } ) ;
133
133
assert . equal ( host . getOutput ( ) . length , 0 , "expect 0 messages" ) ;
134
134
135
135
// run first step
@@ -148,10 +148,10 @@ describe("unittests:: tsserver:: cancellationToken", () => {
148
148
}
149
149
{
150
150
const getErrId = session . getNextSeq ( ) ;
151
- session . executeCommandSeq ( {
152
- command : "geterr" ,
153
- arguments : { files : [ f1 . path ] }
154
- } as ts . server . protocol . GeterrRequest ) ;
151
+ session . executeCommandSeq < ts . server . protocol . GeterrRequest > ( {
152
+ command : ts . server . protocol . CommandTypes . Geterr ,
153
+ arguments : { files : [ f1 . path ] , delay : 0 }
154
+ } ) ;
155
155
assert . equal ( host . getOutput ( ) . length , 0 , "expect 0 messages" ) ;
156
156
157
157
// run first step
@@ -178,10 +178,10 @@ describe("unittests:: tsserver:: cancellationToken", () => {
178
178
}
179
179
{
180
180
const getErr1 = session . getNextSeq ( ) ;
181
- session . executeCommandSeq ( {
182
- command : "geterr" ,
183
- arguments : { files : [ f1 . path ] }
184
- } as ts . server . protocol . GeterrRequest ) ;
181
+ session . executeCommandSeq < ts . server . protocol . GeterrRequest > ( {
182
+ command : ts . server . protocol . CommandTypes . Geterr ,
183
+ arguments : { files : [ f1 . path ] , delay : 0 }
184
+ } ) ;
185
185
assert . equal ( host . getOutput ( ) . length , 0 , "expect 0 messages" ) ;
186
186
// run first step
187
187
host . runQueuedTimeoutCallbacks ( ) ;
@@ -190,10 +190,10 @@ describe("unittests:: tsserver:: cancellationToken", () => {
190
190
assert . equal ( e1 . event , "syntaxDiag" ) ;
191
191
session . clearMessages ( ) ;
192
192
193
- session . executeCommandSeq ( {
194
- command : "geterr" ,
195
- arguments : { files : [ f1 . path ] }
196
- } as ts . server . protocol . GeterrRequest ) ;
193
+ session . executeCommandSeq < ts . server . protocol . GeterrRequest > ( {
194
+ command : ts . server . protocol . CommandTypes . Geterr ,
195
+ arguments : { files : [ f1 . path ] , delay : 0 }
196
+ } ) ;
197
197
// make sure that getErr1 is completed
198
198
verifyRequestCompleted ( getErr1 , 0 ) ;
199
199
}
@@ -230,34 +230,34 @@ describe("unittests:: tsserver:: cancellationToken", () => {
230
230
throttleWaitMilliseconds : 0
231
231
} ) ;
232
232
{
233
- session . executeCommandSeq ( {
234
- command : "open" ,
233
+ session . executeCommandSeq < ts . server . protocol . OpenRequest > ( {
234
+ command : ts . server . protocol . CommandTypes . Open ,
235
235
arguments : { file : f1 . path }
236
- } as ts . server . protocol . OpenRequest ) ;
236
+ } ) ;
237
237
238
238
// send navbar request (normal priority)
239
- session . executeCommandSeq ( {
240
- command : "navbar" ,
239
+ session . executeCommandSeq < ts . server . protocol . NavBarRequest > ( {
240
+ command : ts . server . protocol . CommandTypes . NavBar ,
241
241
arguments : { file : f1 . path }
242
- } as ts . server . protocol . NavBarRequest ) ;
242
+ } ) ;
243
243
244
244
// ensure the nav bar request can be canceled
245
- verifyExecuteCommandSeqIsCancellable ( {
246
- command : "navbar" ,
245
+ verifyExecuteCommandSeqIsCancellable < ts . server . protocol . NavBarRequest > ( {
246
+ command : ts . server . protocol . CommandTypes . NavBar ,
247
247
arguments : { file : f1 . path }
248
- } as ts . server . protocol . NavBarRequest ) ;
248
+ } ) ;
249
249
250
250
// send outlining spans request (normal priority)
251
- session . executeCommandSeq ( {
252
- command : "outliningSpans" ,
251
+ session . executeCommandSeq < ts . server . protocol . OutliningSpansRequestFull > ( {
252
+ command : ts . server . protocol . CommandTypes . GetOutliningSpansFull ,
253
253
arguments : { file : f1 . path }
254
- } as ts . server . protocol . OutliningSpansRequestFull ) ;
254
+ } ) ;
255
255
256
256
// ensure the outlining spans request can be canceled
257
- verifyExecuteCommandSeqIsCancellable ( {
258
- command : "outliningSpans" ,
257
+ verifyExecuteCommandSeqIsCancellable < ts . server . protocol . OutliningSpansRequestFull > ( {
258
+ command : ts . server . protocol . CommandTypes . GetOutliningSpansFull ,
259
259
arguments : { file : f1 . path }
260
- } as ts . server . protocol . OutliningSpansRequestFull ) ;
260
+ } ) ;
261
261
}
262
262
263
263
function verifyExecuteCommandSeqIsCancellable < T extends ts . server . protocol . Request > ( request : TestSessionRequest < T > ) {
0 commit comments