Skip to content

Commit

Permalink
feat: add server restart command.
Browse files Browse the repository at this point in the history
  • Loading branch information
yassun7010 committed Feb 3, 2025
1 parent 5056187 commit 6ed8616
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions editors/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
"command": "tombi.showLanguageServerVersion",
"title": "Show Language Server Version",
"category": "Tombi"
},
{
"command": "tombi.restartLanguageServer",
"title": "Restart Language Server",
"category": "Tombi"
}
],
"configuration": {
Expand Down
3 changes: 2 additions & 1 deletion editors/vscode/src/command/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { showLanguageServerVersion } from "./show-language-server-version";
import { restartLanguageServer } from "./restart-language-server";

export { showLanguageServerVersion };
export { showLanguageServerVersion, restartLanguageServer };
7 changes: 7 additions & 0 deletions editors/vscode/src/command/restart-language-server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type * as node from "vscode-languageclient/node";

export async function restartLanguageServer(
client: node.LanguageClient,
): Promise<void> {
await client.restart();
}
6 changes: 6 additions & 0 deletions editors/vscode/src/extention/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ export class Extension {
async () => command.showLanguageServerVersion(this.server),
),
);
this.context.subscriptions.push(
vscode.commands.registerCommand(
`${EXTENTION_ID}.restartLanguageServer`,
async () => command.restartLanguageServer(this.client),
),
);
}

private registerEvents(): void {
Expand Down

0 comments on commit 6ed8616

Please sign in to comment.