mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Pass CodeActionKind through our middleware to populate menus
This commit is contained in:
parent
b98c16a034
commit
5b9257561f
1 changed files with 4 additions and 2 deletions
|
@ -66,7 +66,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
|
|||
return Promise.resolve(null);
|
||||
});
|
||||
},
|
||||
// Using custom handling of CodeActions where each code action is resloved lazily
|
||||
// Using custom handling of CodeActions where each code action is resolved lazily
|
||||
// That's why we are not waiting for any command or edits
|
||||
async provideCodeActions(document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken, _next: lc.ProvideCodeActionsSignature) {
|
||||
const params: lc.CodeActionParams = {
|
||||
|
@ -87,7 +87,8 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
|
|||
continue;
|
||||
}
|
||||
assert(isCodeActionWithoutEditsAndCommands(item), "We don't expect edits or commands here");
|
||||
const action = new vscode.CodeAction(item.title);
|
||||
const kind = client.protocol2CodeConverter.asCodeActionKind((item as any).kind);
|
||||
const action = new vscode.CodeAction(item.title, kind);
|
||||
const group = (item as any).group;
|
||||
const id = (item as any).id;
|
||||
const resolveParams: ra.ResolveCodeActionParams = {
|
||||
|
@ -116,6 +117,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
|
|||
result[index] = items[0];
|
||||
} else {
|
||||
const action = new vscode.CodeAction(group);
|
||||
action.kind = items[0].kind;
|
||||
action.command = {
|
||||
command: "rust-analyzer.applyActionGroup",
|
||||
title: "",
|
||||
|
|
Loading…
Reference in a new issue