mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-04 07:35:49 +00:00
CodeAction groups
This commit is contained in:
parent
5ef4ebff20
commit
2075e77ee5
11 changed files with 109 additions and 83 deletions
|
@ -41,15 +41,11 @@ export function applySourceChange(ctx: Ctx): Cmd {
|
|||
};
|
||||
}
|
||||
|
||||
export function selectAndApplySourceChange(ctx: Ctx): Cmd {
|
||||
return async (changes: ra.SourceChange[]) => {
|
||||
if (changes.length === 1) {
|
||||
await sourceChange.applySourceChange(ctx, changes[0]);
|
||||
} else if (changes.length > 0) {
|
||||
const selectedChange = await vscode.window.showQuickPick(changes);
|
||||
if (!selectedChange) return;
|
||||
await sourceChange.applySourceChange(ctx, selectedChange);
|
||||
}
|
||||
export function applyActionGroup(_ctx: Ctx): Cmd {
|
||||
return async (actions: { label: string; edit: vscode.WorkspaceEdit }[]) => {
|
||||
const selectedAction = await vscode.window.showQuickPick(actions);
|
||||
if (!selectedAction) return;
|
||||
await applySnippetWorkspaceEdit(selectedAction.edit);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue