From 12f28f6276bbf1d1a19a553c7352bcb974361247 Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Mon, 15 Apr 2019 21:41:27 +0200 Subject: Adds "restart server" command --- editors/code/src/extension.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'editors/code/src') diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts index ef83c0b8b..db67bc7e3 100644 --- a/editors/code/src/extension.ts +++ b/editors/code/src/extension.ts @@ -120,11 +120,16 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions ); + const startServer = () => Server.start(allNotifications); + const reloadCommand = () => reloadServer(startServer); + + vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand); + // Executing `cargo watch` provides us with inline diagnostics on save interactivelyStartCargoWatch(context); // Start the language server, finally! - Server.start(allNotifications); + startServer(); } export function deactivate(): Thenable { @@ -133,3 +138,12 @@ export function deactivate(): Thenable { } return Server.client.stop(); } + + +async function reloadServer(startServer: () => void) { + if (Server.client != null) { + vscode.window.showInformationMessage('Reloading rust-analyzer...'); + await Server.client.stop(); + startServer(); + } +} \ No newline at end of file -- cgit v1.2.3 From 3bdd6973d176abe833477e4dfea9b268af57a99e Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Tue, 16 Apr 2019 22:06:27 +0200 Subject: Fixes unrelated process termination quirk --- editors/code/src/utils/terminateProcess.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 editors/code/src/utils/terminateProcess.sh (limited to 'editors/code/src') diff --git a/editors/code/src/utils/terminateProcess.sh b/editors/code/src/utils/terminateProcess.sh old mode 100644 new mode 100755 -- cgit v1.2.3 From 145ee9c3e9e81821053c33363f0ec3c0397d909d Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Tue, 16 Apr 2019 22:11:50 +0200 Subject: Prettier --- editors/code/src/extension.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'editors/code/src') diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts index db67bc7e3..1073a36a0 100644 --- a/editors/code/src/extension.ts +++ b/editors/code/src/extension.ts @@ -139,11 +139,10 @@ export function deactivate(): Thenable { return Server.client.stop(); } - async function reloadServer(startServer: () => void) { if (Server.client != null) { vscode.window.showInformationMessage('Reloading rust-analyzer...'); await Server.client.stop(); startServer(); } -} \ No newline at end of file +} -- cgit v1.2.3