handle Thenable type rejects
This commit is contained in:
parent
1d0e93b58e
commit
1bb4e973ff
|
@ -129,7 +129,8 @@ export function joinLines(ctx: Ctx): Cmd {
|
||||||
client.protocol2CodeConverter.asTextEdits(items).forEach((edit: any) => {
|
client.protocol2CodeConverter.asTextEdits(items).forEach((edit: any) => {
|
||||||
builder.replace(edit.range, edit.newText);
|
builder.replace(edit.range, edit.newText);
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
.then(() => {}, console.error);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +247,8 @@ export function ssr(ctx: Ctx): Cmd {
|
||||||
});
|
});
|
||||||
|
|
||||||
await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit));
|
await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit));
|
||||||
});
|
})
|
||||||
|
.then(() => {}, console.error);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +467,8 @@ export function showReferences(ctx: Ctx): Cmd {
|
||||||
vscode.Uri.parse(uri),
|
vscode.Uri.parse(uri),
|
||||||
client.protocol2CodeConverter.asPosition(position),
|
client.protocol2CodeConverter.asPosition(position),
|
||||||
locations.map(client.protocol2CodeConverter.asLocation),
|
locations.map(client.protocol2CodeConverter.asLocation),
|
||||||
);
|
)
|
||||||
|
.then(() => {}, console.error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -477,7 +480,8 @@ export function applyActionGroup(_ctx: Ctx): Cmd {
|
||||||
vscode.commands.executeCommand(
|
vscode.commands.executeCommand(
|
||||||
'rust-analyzer.resolveCodeAction',
|
'rust-analyzer.resolveCodeAction',
|
||||||
selectedAction.arguments,
|
selectedAction.arguments,
|
||||||
);
|
)
|
||||||
|
.then(() => {}, console.error);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +514,8 @@ export function openDocs(ctx: Ctx): Cmd {
|
||||||
const doclink = await client.sendRequest(ra.openDocs, { position, textDocument });
|
const doclink = await client.sendRequest(ra.openDocs, { position, textDocument });
|
||||||
|
|
||||||
if (doclink != null) {
|
if (doclink != null) {
|
||||||
vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(doclink));
|
vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(doclink))
|
||||||
|
.then(() => {}, console.error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,8 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise<v
|
||||||
|
|
||||||
if (!debugEngine) {
|
if (!debugEngine) {
|
||||||
vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)`
|
vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)`
|
||||||
+ ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension for debugging.`);
|
+ ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension for debugging.`)
|
||||||
|
.then(() => {}, console.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,8 @@ async function tryActivate(context: vscode.ExtensionContext) {
|
||||||
// This a horribly, horribly wrong way to deal with this problem.
|
// This a horribly, horribly wrong way to deal with this problem.
|
||||||
ctx = await Ctx.create(config, context, serverPath, workspaceFolder.uri.fsPath);
|
ctx = await Ctx.create(config, context, serverPath, workspaceFolder.uri.fsPath);
|
||||||
|
|
||||||
setContextValue(RUST_PROJECT_CONTEXT_NAME, true);
|
setContextValue(RUST_PROJECT_CONTEXT_NAME, true)
|
||||||
|
.then(() => {}, console.error);
|
||||||
|
|
||||||
// Commands which invokes manually via command palette, shortcut, etc.
|
// Commands which invokes manually via command palette, shortcut, etc.
|
||||||
|
|
||||||
|
@ -142,7 +143,8 @@ async function tryActivate(context: vscode.ExtensionContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deactivate() {
|
export async function deactivate() {
|
||||||
setContextValue(RUST_PROJECT_CONTEXT_NAME, undefined);
|
setContextValue(RUST_PROJECT_CONTEXT_NAME, undefined)
|
||||||
|
.then(() => {}, console.error);
|
||||||
await ctx?.client.stop();
|
await ctx?.client.stop();
|
||||||
ctx = undefined;
|
ctx = undefined;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +188,8 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
if (state.releaseId === undefined) { // Show error only for the initial download
|
if (state.releaseId === undefined) { // Show error only for the initial download
|
||||||
vscode.window.showErrorMessage(`Failed to download rust-analyzer nightly ${e}`);
|
vscode.window.showErrorMessage(`Failed to download rust-analyzer nightly ${e}`)
|
||||||
|
.then(() => {}, console.error);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
});
|
});
|
||||||
|
@ -305,7 +308,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
|
||||||
"If you feel that your platform should be supported, please create an issue " +
|
"If you feel that your platform should be supported, please create an issue " +
|
||||||
"about that [here](https://github.com/rust-analyzer/rust-analyzer/issues) and we " +
|
"about that [here](https://github.com/rust-analyzer/rust-analyzer/issues) and we " +
|
||||||
"will consider it."
|
"will consider it."
|
||||||
);
|
).then(() => {}, console.error);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : "";
|
const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : "";
|
||||||
|
@ -433,6 +436,7 @@ function warnAboutExtensionConflicts() {
|
||||||
vscode.window.showWarningMessage(
|
vscode.window.showWarningMessage(
|
||||||
`You have both the ${fst[0]} (${fst[1]}) and ${sec[0]} (${sec[1]}) ` +
|
`You have both the ${fst[0]} (${fst[1]}) and ${sec[0]} (${sec[1]}) ` +
|
||||||
"plugins enabled. These are known to conflict and cause various functions of " +
|
"plugins enabled. These are known to conflict and cause various functions of " +
|
||||||
"both plugins to not work correctly. You should disable one of them.", "Got it");
|
"both plugins to not work correctly. You should disable one of them.", "Got it")
|
||||||
|
.then(() => {}, console.error);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,8 @@ export async function selectRunnable(ctx: Ctx, prevRunnable?: RunnableQuickPick,
|
||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
// it is the debug case, run always has at least 'cargo check ...'
|
// it is the debug case, run always has at least 'cargo check ...'
|
||||||
// see crates\rust-analyzer\src\main_loop\handlers.rs, handle_runnables
|
// see crates\rust-analyzer\src\main_loop\handlers.rs, handle_runnables
|
||||||
vscode.window.showErrorMessage("There's no debug target!");
|
vscode.window.showErrorMessage("There's no debug target!")
|
||||||
|
.then(() => {}, console.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue