aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/extension.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/extension.ts')
-rw-r--r--editors/code/src/extension.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index 683497dfd..6637c3bf0 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -14,7 +14,7 @@ import * as events from './events';
14import * as notifications from './notifications'; 14import * as notifications from './notifications';
15import { Server } from './server'; 15import { Server } from './server';
16 16
17export function activate(context: vscode.ExtensionContext) { 17export async function activate(context: vscode.ExtensionContext) {
18 function disposeOnDeactivation(disposable: vscode.Disposable) { 18 function disposeOnDeactivation(disposable: vscode.Disposable) {
19 context.subscriptions.push(disposable); 19 context.subscriptions.push(disposable);
20 } 20 }
@@ -159,7 +159,11 @@ export function activate(context: vscode.ExtensionContext) {
159 }); 159 });
160 160
161 // Start the language server, finally! 161 // Start the language server, finally!
162 startServer(); 162 try {
163 await startServer();
164 } catch (e) {
165 vscode.window.showErrorMessage(e.message);
166 }
163 167
164 if (Server.config.displayInlayHints) { 168 if (Server.config.displayInlayHints) {
165 const hintsUpdater = new HintsUpdater(); 169 const hintsUpdater = new HintsUpdater();
@@ -204,10 +208,10 @@ export function deactivate(): Thenable<void> {
204 return Server.client.stop(); 208 return Server.client.stop();
205} 209}
206 210
207async function reloadServer(startServer: () => void) { 211async function reloadServer(startServer: () => Promise<void>) {
208 if (Server.client != null) { 212 if (Server.client != null) {
209 vscode.window.showInformationMessage('Reloading rust-analyzer...'); 213 vscode.window.showInformationMessage('Reloading rust-analyzer...');
210 await Server.client.stop(); 214 await Server.client.stop();
211 startServer(); 215 await startServer();
212 } 216 }
213} 217}