Skip to content

Commit 67aa069

Browse files
committed
Adding a command to stop the LSP server
Signed-off-by: Maxim Zaks <maxim.zaks@gmail.com>
1 parent fcc16e7 commit 67aa069

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

extension/lsp/lsp.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ export class MojoLSPManager extends DisposableContext {
8686
}),
8787
);
8888

89+
this.pushSubscription(
90+
vscode.commands.registerCommand('mojo.lsp.stop', async () => {
91+
if (this.lspClient) {
92+
await this.lspClient.stop();
93+
}
94+
}),
95+
);
96+
8997
if (
9098
this.extensionContext.extensionMode == vscode.ExtensionMode.Development ||
9199
this.extensionContext.extensionMode == vscode.ExtensionMode.Test
@@ -345,8 +353,7 @@ export class MojoLSPManager extends DisposableContext {
345353
);
346354

347355
this.logger.lsp.info(
348-
`Launching Language Server '${
349-
initializationOptions.serverPath
356+
`Launching Language Server '${initializationOptions.serverPath
350357
}' with options:`,
351358
initializationOptions.serverArgs,
352359
);

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@
178178
"command": "mojo.lsp.restart",
179179
"title": "Restart the Mojo LSP Server"
180180
},
181+
{
182+
"category": "Developer",
183+
"command": "mojo.lsp.stop",
184+
"title": "Stop the Mojo LSP Server"
185+
},
181186
{
182187
"category": "Mojo",
183188
"command": "mojo.lsp.startRecord",

0 commit comments

Comments
 (0)