mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
use await instead
This commit is contained in:
parent
2f82a84d2a
commit
91dd61b9a6
4 changed files with 21 additions and 31 deletions
|
@ -125,12 +125,11 @@ export function joinLines(ctx: Ctx): Cmd {
|
|||
ranges: editor.selections.map((it) => client.code2ProtocolConverter.asRange(it)),
|
||||
textDocument: ctx.client.code2ProtocolConverter.asTextDocumentIdentifier(editor.document),
|
||||
});
|
||||
editor.edit((builder) => {
|
||||
await editor.edit((builder) => {
|
||||
client.protocol2CodeConverter.asTextEdits(items).forEach((edit: any) => {
|
||||
builder.replace(edit.range, edit.newText);
|
||||
});
|
||||
})
|
||||
.then(() => { }, console.error);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -237,7 +236,7 @@ export function ssr(ctx: Ctx): Cmd {
|
|||
const request = await vscode.window.showInputBox(options);
|
||||
if (!request) return;
|
||||
|
||||
vscode.window.withProgress({
|
||||
await vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Notification,
|
||||
title: "Structured search replace in progress...",
|
||||
cancellable: false,
|
||||
|
@ -247,8 +246,7 @@ export function ssr(ctx: Ctx): Cmd {
|
|||
});
|
||||
|
||||
await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit));
|
||||
})
|
||||
.then(() => { }, console.error);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -459,16 +457,15 @@ export function reloadWorkspace(ctx: Ctx): Cmd {
|
|||
}
|
||||
|
||||
export function showReferences(ctx: Ctx): Cmd {
|
||||
return (uri: string, position: lc.Position, locations: lc.Location[]) => {
|
||||
return async (uri: string, position: lc.Position, locations: lc.Location[]) => {
|
||||
const client = ctx.client;
|
||||
if (client) {
|
||||
vscode.commands.executeCommand(
|
||||
await vscode.commands.executeCommand(
|
||||
'editor.action.showReferences',
|
||||
vscode.Uri.parse(uri),
|
||||
client.protocol2CodeConverter.asPosition(position),
|
||||
locations.map(client.protocol2CodeConverter.asLocation),
|
||||
)
|
||||
.then(() => { }, console.error);
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -477,11 +474,10 @@ export function applyActionGroup(_ctx: Ctx): Cmd {
|
|||
return async (actions: { label: string; arguments: lc.CodeAction }[]) => {
|
||||
const selectedAction = await vscode.window.showQuickPick(actions);
|
||||
if (!selectedAction) return;
|
||||
vscode.commands.executeCommand(
|
||||
await vscode.commands.executeCommand(
|
||||
'rust-analyzer.resolveCodeAction',
|
||||
selectedAction.arguments,
|
||||
)
|
||||
.then(() => { }, console.error);
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -514,8 +510,7 @@ export function openDocs(ctx: Ctx): Cmd {
|
|||
const doclink = await client.sendRequest(ra.openDocs, { position, textDocument });
|
||||
|
||||
if (doclink != null) {
|
||||
vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(doclink))
|
||||
.then(() => { }, console.error);
|
||||
await vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(doclink));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue