aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-17 06:51:12 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-17 06:51:12 +0100
commitd3afb1b3782683c3e800b38b4c24b7581918fb7f (patch)
treed9a37343c1227c94eaefc54671ddb562faeaf20c /editors/code/src
parent0e35603069b4f3cee97641204b09d91fd723d01d (diff)
parent8d569d49d2508cd7b50dd3d00d5509d4128bf645 (diff)
Merge #1153
1153: "Restart server" command r=jrvidal a=jrvidal The only tricky aspect is that fact that once the `exit` command has been received, we no longer need to join on the reader thread. Also, I think `terminateProcesses.sh` was not working properly. In fact, the very same script from the vscode language server implementation is not working either! It's because of that I noticed the reader thread issue :open_mouth: Co-authored-by: Roberto Vidal <[email protected]>
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/extension.ts15
-rwxr-xr-x[-rw-r--r--]editors/code/src/utils/terminateProcess.sh0
2 files changed, 14 insertions, 1 deletions
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index ef83c0b8b..1073a36a0 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -120,11 +120,16 @@ export function activate(context: vscode.ExtensionContext) {
120 context.subscriptions 120 context.subscriptions
121 ); 121 );
122 122
123 const startServer = () => Server.start(allNotifications);
124 const reloadCommand = () => reloadServer(startServer);
125
126 vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand);
127
123 // Executing `cargo watch` provides us with inline diagnostics on save 128 // Executing `cargo watch` provides us with inline diagnostics on save
124 interactivelyStartCargoWatch(context); 129 interactivelyStartCargoWatch(context);
125 130
126 // Start the language server, finally! 131 // Start the language server, finally!
127 Server.start(allNotifications); 132 startServer();
128} 133}
129 134
130export function deactivate(): Thenable<void> { 135export function deactivate(): Thenable<void> {
@@ -133,3 +138,11 @@ export function deactivate(): Thenable<void> {
133 } 138 }
134 return Server.client.stop(); 139 return Server.client.stop();
135} 140}
141
142async function reloadServer(startServer: () => void) {
143 if (Server.client != null) {
144 vscode.window.showInformationMessage('Reloading rust-analyzer...');
145 await Server.client.stop();
146 startServer();
147 }
148}
diff --git a/editors/code/src/utils/terminateProcess.sh b/editors/code/src/utils/terminateProcess.sh
index 2ec9e1c2e..2ec9e1c2e 100644..100755
--- a/editors/code/src/utils/terminateProcess.sh
+++ b/editors/code/src/utils/terminateProcess.sh