aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/main.ts
diff options
context:
space:
mode:
authorSahandevs <[email protected]>2021-02-09 14:12:46 +0000
committerSahandevs <[email protected]>2021-02-09 14:12:46 +0000
commit91dd61b9a662caf628a376d1e3b52b56b7ee8d31 (patch)
tree22d5ec3c2abd8058ce97ca9102075427cea02e4a /editors/code/src/main.ts
parent2f82a84d2a06e24296bdbc4e8f50131539d5a749 (diff)
use await instead
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r--editors/code/src/main.ts15
1 files changed, 6 insertions, 9 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index ecbe4e3c9..5c0b0be26 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -76,8 +76,7 @@ async function tryActivate(context: vscode.ExtensionContext) {
76 // This a horribly, horribly wrong way to deal with this problem. 76 // This a horribly, horribly wrong way to deal with this problem.
77 ctx = await Ctx.create(config, context, serverPath, workspaceFolder.uri.fsPath); 77 ctx = await Ctx.create(config, context, serverPath, workspaceFolder.uri.fsPath);
78 78
79 setContextValue(RUST_PROJECT_CONTEXT_NAME, true) 79 await setContextValue(RUST_PROJECT_CONTEXT_NAME, true);
80 .then(() => { }, console.error);
81 80
82 // Commands which invokes manually via command palette, shortcut, etc. 81 // Commands which invokes manually via command palette, shortcut, etc.
83 82
@@ -143,8 +142,7 @@ async function tryActivate(context: vscode.ExtensionContext) {
143} 142}
144 143
145export async function deactivate() { 144export async function deactivate() {
146 setContextValue(RUST_PROJECT_CONTEXT_NAME, undefined) 145 await setContextValue(RUST_PROJECT_CONTEXT_NAME, undefined);
147 .then(() => { }, console.error);
148 await ctx?.client.stop(); 146 await ctx?.client.stop();
149 ctx = undefined; 147 ctx = undefined;
150} 148}
@@ -185,11 +183,10 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
185 183
186 const release = await downloadWithRetryDialog(state, async () => { 184 const release = await downloadWithRetryDialog(state, async () => {
187 return await fetchRelease("nightly", state.githubToken); 185 return await fetchRelease("nightly", state.githubToken);
188 }).catch((e) => { 186 }).catch(async (e) => {
189 log.error(e); 187 log.error(e);
190 if (state.releaseId === undefined) { // Show error only for the initial download 188 if (state.releaseId === undefined) { // Show error only for the initial download
191 vscode.window.showErrorMessage(`Failed to download rust-analyzer nightly ${e}`) 189 await vscode.window.showErrorMessage(`Failed to download rust-analyzer nightly ${e}`);
192 .then(() => { }, console.error);
193 } 190 }
194 return undefined; 191 return undefined;
195 }); 192 });
@@ -301,14 +298,14 @@ async function getServer(config: Config, state: PersistentState): Promise<string
301 }; 298 };
302 const platform = platforms[`${process.arch} ${process.platform}`]; 299 const platform = platforms[`${process.arch} ${process.platform}`];
303 if (platform === undefined) { 300 if (platform === undefined) {
304 vscode.window.showErrorMessage( 301 await vscode.window.showErrorMessage(
305 "Unfortunately we don't ship binaries for your platform yet. " + 302 "Unfortunately we don't ship binaries for your platform yet. " +
306 "You need to manually clone rust-analyzer repository and " + 303 "You need to manually clone rust-analyzer repository and " +
307 "run `cargo xtask install --server` to build the language server from sources. " + 304 "run `cargo xtask install --server` to build the language server from sources. " +
308 "If you feel that your platform should be supported, please create an issue " + 305 "If you feel that your platform should be supported, please create an issue " +
309 "about that [here](https://github.com/rust-analyzer/rust-analyzer/issues) and we " + 306 "about that [here](https://github.com/rust-analyzer/rust-analyzer/issues) and we " +
310 "will consider it." 307 "will consider it."
311 ).then(() => { }, console.error); 308 );
312 return undefined; 309 return undefined;
313 } 310 }
314 const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : ""; 311 const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : "";