File tree Expand file tree Collapse file tree
tests/baselines/reference/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,6 +169,19 @@ namespace ts.server {
169169 allowNonTsExtensions : true // injected by tsserver
170170 } ) ;
171171 } ) ;
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+ } ) ;
172185 } ) ;
173186
174187 describe ( "onMessage" , ( ) => {
@@ -220,6 +233,7 @@ namespace ts.server {
220233 CommandNames . Saveto ,
221234 CommandNames . SignatureHelp ,
222235 CommandNames . SignatureHelpFull ,
236+ CommandNames . Status ,
223237 CommandNames . TypeDefinition ,
224238 CommandNames . ProjectInfo ,
225239 CommandNames . ReloadProjects ,
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ namespace ts.server.protocol {
7171 SignatureHelp = "signatureHelp" ,
7272 /* @internal */
7373 SignatureHelpFull = "signatureHelp-full" ,
74+ Status = "status" ,
7475 TypeDefinition = "typeDefinition" ,
7576 ProjectInfo = "projectInfo" ,
7677 ReloadProjects = "reloadProjects" ,
@@ -216,6 +217,24 @@ namespace ts.server.protocol {
216217 projectFileName ?: string ;
217218 }
218219
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+
219238 /**
220239 * Requests a JS Doc comment template for a given position
221240 */
Original file line number Diff line number Diff line change @@ -1703,6 +1703,10 @@ namespace ts.server {
17031703 }
17041704
17051705 private handlers = createMapFromTemplate < ( request : protocol . Request ) => HandlerResponse > ( {
1706+ [ CommandNames . Status ] : ( ) => {
1707+ const response : protocol . StatusResponseBody = { version } ;
1708+ return this . requiredResponse ( response ) ;
1709+ } ,
17061710 [ CommandNames . OpenExternalProject ] : ( request : protocol . OpenExternalProjectRequest ) => {
17071711 this . projectService . openExternalProject ( request . arguments , /*suppressRefreshOfInferredProjects*/ false ) ;
17081712 // TODO: GH#20447 report errors
Original file line number Diff line number Diff line change @@ -4905,6 +4905,7 @@ declare namespace ts.server.protocol {
49054905 Rename = "rename" ,
49064906 Saveto = "saveto" ,
49074907 SignatureHelp = "signatureHelp" ,
4908+ Status = "status" ,
49084909 TypeDefinition = "typeDefinition" ,
49094910 ProjectInfo = "projectInfo" ,
49104911 ReloadProjects = "reloadProjects" ,
@@ -5006,6 +5007,21 @@ declare namespace ts.server.protocol {
50065007 file : string ;
50075008 projectFileName ?: string ;
50085009 }
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+ }
50095025 /**
50105026 * Requests a JS Doc comment template for a given position
50115027 */
You can’t perform that action at this time.
0 commit comments