File tree 4 files changed +53
-0
lines changed
tests/baselines/reference/api
4 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,19 @@ namespace ts.server {
169
169
allowNonTsExtensions : true // injected by tsserver
170
170
} ) ;
171
171
} ) ;
172
+
173
+ it ( "Status request gives ts.version" , ( ) => {
174
+ const req : protocol . StatusRequest = {
175
+ command : CommandNames . Status ,
176
+ seq : 0 ,
177
+ type : "request"
178
+ } ;
179
+
180
+ const expected : protocol . StatusResponseBody = {
181
+ version : ts . version
182
+ } ;
183
+ assert . deepEqual ( session . executeCommand ( req ) . response , expected ) ;
184
+ } ) ;
172
185
} ) ;
173
186
174
187
describe ( "onMessage" , ( ) => {
@@ -220,6 +233,7 @@ namespace ts.server {
220
233
CommandNames . Saveto ,
221
234
CommandNames . SignatureHelp ,
222
235
CommandNames . SignatureHelpFull ,
236
+ CommandNames . Status ,
223
237
CommandNames . TypeDefinition ,
224
238
CommandNames . ProjectInfo ,
225
239
CommandNames . ReloadProjects ,
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ namespace ts.server.protocol {
71
71
SignatureHelp = "signatureHelp" ,
72
72
/* @internal */
73
73
SignatureHelpFull = "signatureHelp-full" ,
74
+ Status = "status" ,
74
75
TypeDefinition = "typeDefinition" ,
75
76
ProjectInfo = "projectInfo" ,
76
77
ReloadProjects = "reloadProjects" ,
@@ -216,6 +217,24 @@ namespace ts.server.protocol {
216
217
projectFileName ?: string ;
217
218
}
218
219
220
+ export interface StatusRequest extends Request {
221
+ command : CommandTypes . Status ;
222
+ }
223
+
224
+ export interface StatusResponseBody {
225
+ /**
226
+ * The TypeScript version (`ts.version`).
227
+ */
228
+ version : string ;
229
+ }
230
+
231
+ /**
232
+ * Response to StatusRequest
233
+ */
234
+ export interface StatusResponse extends Response {
235
+ body : StatusResponseBody ;
236
+ }
237
+
219
238
/**
220
239
* Requests a JS Doc comment template for a given position
221
240
*/
Original file line number Diff line number Diff line change @@ -1703,6 +1703,10 @@ namespace ts.server {
1703
1703
}
1704
1704
1705
1705
private handlers = createMapFromTemplate < ( request : protocol . Request ) => HandlerResponse > ( {
1706
+ [ CommandNames . Status ] : ( ) => {
1707
+ const response : protocol . StatusResponseBody = { version } ;
1708
+ return this . requiredResponse ( response ) ;
1709
+ } ,
1706
1710
[ CommandNames . OpenExternalProject ] : ( request : protocol . OpenExternalProjectRequest ) => {
1707
1711
this . projectService . openExternalProject ( request . arguments , /*suppressRefreshOfInferredProjects*/ false ) ;
1708
1712
// TODO: GH#20447 report errors
Original file line number Diff line number Diff line change @@ -4905,6 +4905,7 @@ declare namespace ts.server.protocol {
4905
4905
Rename = "rename" ,
4906
4906
Saveto = "saveto" ,
4907
4907
SignatureHelp = "signatureHelp" ,
4908
+ Status = "status" ,
4908
4909
TypeDefinition = "typeDefinition" ,
4909
4910
ProjectInfo = "projectInfo" ,
4910
4911
ReloadProjects = "reloadProjects" ,
@@ -5006,6 +5007,21 @@ declare namespace ts.server.protocol {
5006
5007
file : string ;
5007
5008
projectFileName ?: string ;
5008
5009
}
5010
+ interface StatusRequest extends Request {
5011
+ command : CommandTypes . Status ;
5012
+ }
5013
+ interface StatusResponseBody {
5014
+ /**
5015
+ * The TypeScript version (`ts.version`).
5016
+ */
5017
+ version : string ;
5018
+ }
5019
+ /**
5020
+ * Response to StatusRequest
5021
+ */
5022
+ interface StatusResponse extends Response {
5023
+ body : StatusResponseBody ;
5024
+ }
5009
5025
/**
5010
5026
* Requests a JS Doc comment template for a given position
5011
5027
*/
You can’t perform that action at this time.
0 commit comments