aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/src/commands.ts15
-rw-r--r--editors/code/src/debug.ts3
-rw-r--r--editors/code/src/main.ts14
-rw-r--r--editors/code/src/run.ts3
4 files changed, 23 insertions, 12 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index cbda619ea..3469fe5ec 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -129,7 +129,8 @@ export function joinLines(ctx: Ctx): Cmd {
129 client.protocol2CodeConverter.asTextEdits(items).forEach((edit: any) => { 129 client.protocol2CodeConverter.asTextEdits(items).forEach((edit: any) => {
130 builder.replace(edit.range, edit.newText); 130 builder.replace(edit.range, edit.newText);
131 }); 131 });
132 }); 132 })
133 .then(() => {}, console.error);
133 }; 134 };
134} 135}
135 136
@@ -246,7 +247,8 @@ export function ssr(ctx: Ctx): Cmd {
246 }); 247 });
247 248
248 await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit)); 249 await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit));
249 }); 250 })
251 .then(() => {}, console.error);
250 }; 252 };
251} 253}
252 254
@@ -465,7 +467,8 @@ export function showReferences(ctx: Ctx): Cmd {
465 vscode.Uri.parse(uri), 467 vscode.Uri.parse(uri),
466 client.protocol2CodeConverter.asPosition(position), 468 client.protocol2CodeConverter.asPosition(position),
467 locations.map(client.protocol2CodeConverter.asLocation), 469 locations.map(client.protocol2CodeConverter.asLocation),
468 ); 470 )
471 .then(() => {}, console.error);
469 } 472 }
470 }; 473 };
471} 474}
@@ -477,7 +480,8 @@ export function applyActionGroup(_ctx: Ctx): Cmd {
477 vscode.commands.executeCommand( 480 vscode.commands.executeCommand(
478 'rust-analyzer.resolveCodeAction', 481 'rust-analyzer.resolveCodeAction',
479 selectedAction.arguments, 482 selectedAction.arguments,
480 ); 483 )
484 .then(() => {}, console.error);
481 }; 485 };
482} 486}
483 487
@@ -510,7 +514,8 @@ export function openDocs(ctx: Ctx): Cmd {
510 const doclink = await client.sendRequest(ra.openDocs, { position, textDocument }); 514 const doclink = await client.sendRequest(ra.openDocs, { position, textDocument });
511 515
512 if (doclink != null) { 516 if (doclink != null) {
513 vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(doclink)); 517 vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(doclink))
518 .then(() => {}, console.error);
514 } 519 }
515 }; 520 };
516 521
diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts
index 874b858d9..0bbaae2b0 100644
--- a/editors/code/src/debug.ts
+++ b/editors/code/src/debug.ts
@@ -78,7 +78,8 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise<v
78 78
79 if (!debugEngine) { 79 if (!debugEngine) {
80 vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)` 80 vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)`
81 + ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension for debugging.`); 81 + ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension for debugging.`)
82 .then(() => {}, console.error);
82 return; 83 return;
83 } 84 }
84 85
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 1900d900a..a5c728b67 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -76,7 +76,8 @@ 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 setContextValue(RUST_PROJECT_CONTEXT_NAME, true)
80 .then(() => {}, console.error);
80 81
81 // Commands which invokes manually via command palette, shortcut, etc. 82 // Commands which invokes manually via command palette, shortcut, etc.
82 83
@@ -142,7 +143,8 @@ async function tryActivate(context: vscode.ExtensionContext) {
142} 143}
143 144
144export async function deactivate() { 145export async function deactivate() {
145 setContextValue(RUST_PROJECT_CONTEXT_NAME, undefined); 146 setContextValue(RUST_PROJECT_CONTEXT_NAME, undefined)
147 .then(() => {}, console.error);
146 await ctx?.client.stop(); 148 await ctx?.client.stop();
147 ctx = undefined; 149 ctx = undefined;
148} 150}
@@ -186,7 +188,8 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
186 }).catch((e) => { 188 }).catch((e) => {
187 log.error(e); 189 log.error(e);
188 if (state.releaseId === undefined) { // Show error only for the initial download 190 if (state.releaseId === undefined) { // Show error only for the initial download
189 vscode.window.showErrorMessage(`Failed to download rust-analyzer nightly ${e}`); 191 vscode.window.showErrorMessage(`Failed to download rust-analyzer nightly ${e}`)
192 .then(() => {}, console.error);
190 } 193 }
191 return undefined; 194 return undefined;
192 }); 195 });
@@ -305,7 +308,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
305 "If you feel that your platform should be supported, please create an issue " + 308 "If you feel that your platform should be supported, please create an issue " +
306 "about that [here](https://github.com/rust-analyzer/rust-analyzer/issues) and we " + 309 "about that [here](https://github.com/rust-analyzer/rust-analyzer/issues) and we " +
307 "will consider it." 310 "will consider it."
308 ); 311 ).then(() => {}, console.error);
309 return undefined; 312 return undefined;
310 } 313 }
311 const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : ""; 314 const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : "";
@@ -433,6 +436,7 @@ function warnAboutExtensionConflicts() {
433 vscode.window.showWarningMessage( 436 vscode.window.showWarningMessage(
434 `You have both the ${fst[0]} (${fst[1]}) and ${sec[0]} (${sec[1]}) ` + 437 `You have both the ${fst[0]} (${fst[1]}) and ${sec[0]} (${sec[1]}) ` +
435 "plugins enabled. These are known to conflict and cause various functions of " + 438 "plugins enabled. These are known to conflict and cause various functions of " +
436 "both plugins to not work correctly. You should disable one of them.", "Got it"); 439 "both plugins to not work correctly. You should disable one of them.", "Got it")
440 .then(() => {}, console.error);
437 }; 441 };
438} 442}
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts
index 50c17bc7f..e30fdb38e 100644
--- a/editors/code/src/run.ts
+++ b/editors/code/src/run.ts
@@ -45,7 +45,8 @@ export async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick,
45 if (items.length === 0) { 45 if (items.length === 0) {
46 // it is the debug case, run always has at least 'cargo check ...' 46 // it is the debug case, run always has at least 'cargo check ...'
47 // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_runnables 47 // see crates\rust-analyzer\src\main_loop\handlers.rs, handle_runnables
48 vscode.window.showErrorMessage("There's no debug target!"); 48 vscode.window.showErrorMessage("There's no debug target!")
49 .then(() => {}, console.error);
49 return; 50 return;
50 } 51 }
51 52