Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a714ece

Browse files
committed
add status request
1 parent d814233 commit a714ece

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/server/protocol.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff 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,27 @@ namespace ts.server.protocol {
216217
projectFileName?: string;
217218
}
218219

220+
/**
221+
* Requests status information from the server
222+
*/
223+
export interface StatusRequest extends Request {
224+
command: CommandTypes.Status;
225+
}
226+
227+
export interface StatusResponseBody {
228+
/**
229+
* the version of the currently-running server.
230+
*/
231+
version: string;
232+
}
233+
234+
/**
235+
* Response to StatusRequest
236+
*/
237+
export interface StatusResponse extends Response {
238+
body: StatusResponseBody;
239+
}
240+
219241
/**
220242
* Requests a JS Doc comment template for a given position
221243
*/

src/server/session.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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: report errors

0 commit comments

Comments
 (0)