Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Add command to restart language server (#2530)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteelPhase authored and ramya-rao-a committed Jun 4, 2019
1 parent 9655d52 commit 94c8dd8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@
"command": "go.godoctor.var",
"title": "Go: Extract to variable",
"description": "Extract to variable using godoctor."
},
{
"command": "go.languageserver.restart",
"title": "Go: Restart Language Server",
"description": "Restart the running instance of the language server"
}
],
"debuggers": [
Expand Down
10 changes: 9 additions & 1 deletion src/goMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,15 @@ export function activate(ctx: vscode.ExtensionContext): void {

});

ctx.subscriptions.push(c.start());
let languageServerDisposable = c.start();
ctx.subscriptions.push(languageServerDisposable);

ctx.subscriptions.push(vscode.commands.registerCommand('go.languageserver.restart', async () => {
await c.stop();
languageServerDisposable.dispose();
languageServerDisposable = c.start();
ctx.subscriptions.push(languageServerDisposable);
}));

if (languageServerTool !== 'gopls' || !languageServerExperimentalFeatures['diagnostics']) {
vscode.workspace.onDidChangeTextDocument(parseLiveFile, null, ctx.subscriptions);
Expand Down

0 comments on commit 94c8dd8

Please sign in to comment.