mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-12-23 08:48:08 +00:00
Merge ea04b0d1b7 into 624761a864
This commit is contained in:
commit
32ad2510ce
1 changed files with 20 additions and 0 deletions
|
|
@ -260,6 +260,12 @@ export async function createClient(
|
|||
}
|
||||
result.push(primary);
|
||||
}
|
||||
|
||||
result.sort((a, b) => {
|
||||
const priorityA = getActionPriority(a);
|
||||
const priorityB = getActionPriority(b);
|
||||
return priorityA - priorityB;
|
||||
});
|
||||
return result;
|
||||
};
|
||||
return client
|
||||
|
|
@ -413,3 +419,17 @@ function renderHoverActions(actions: ra.CommandLinkGroup[]): vscode.MarkdownStri
|
|||
result.isTrusted = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
const getActionPriority = (action: vscode.CodeAction | vscode.Command): number => {
|
||||
// rust-analyzer diagnostic > rust-analyzer assist > rustc diagnostic > other
|
||||
if (!(action instanceof vscode.CodeAction)) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (action.edit && action.edit.size > 0) return 2;
|
||||
const command = action.command?.command;
|
||||
if (command === "rust-analyzer.resolveCodeAction") return 0;
|
||||
if (command === "rust-analyzer.applyActionGroup") return 1;
|
||||
|
||||
return 3;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue