aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-03 13:44:09 +0100
committerGitHub <[email protected]>2020-07-03 13:44:09 +0100
commitf51b0cfdd6c23dd57a0a11154179730171c0425d (patch)
treef856e6b751b23a20d68e9df5350ec39d5e8ee85b /editors/code/src
parentef6a6d75d5dba2825e6b90e67e0b147a5f7158e1 (diff)
parent4c9347ecc3356748c52847a29d5e53a65778dc13 (diff)
Merge #5116
5116: Categorize assists r=matklad a=kjeremy Categorize assists so that editors can use them. Follows the LSP spec pretty close (and some things may need adjustments) but this populates the Refactor menu in vscode and pushes quickfixes through again. This is a prerequisite to filtering out assists that the client doesn't care about. Fixes #4147 Co-authored-by: Jeremy Kolb <[email protected]> Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/client.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index 3e5915c28..41ffac7b3 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -66,7 +66,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
66 return Promise.resolve(null); 66 return Promise.resolve(null);
67 }); 67 });
68 }, 68 },
69 // Using custom handling of CodeActions where each code action is resloved lazily 69 // Using custom handling of CodeActions where each code action is resolved lazily
70 // That's why we are not waiting for any command or edits 70 // That's why we are not waiting for any command or edits
71 async provideCodeActions(document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken, _next: lc.ProvideCodeActionsSignature) { 71 async provideCodeActions(document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken, _next: lc.ProvideCodeActionsSignature) {
72 const params: lc.CodeActionParams = { 72 const params: lc.CodeActionParams = {
@@ -87,7 +87,8 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
87 continue; 87 continue;
88 } 88 }
89 assert(isCodeActionWithoutEditsAndCommands(item), "We don't expect edits or commands here"); 89 assert(isCodeActionWithoutEditsAndCommands(item), "We don't expect edits or commands here");
90 const action = new vscode.CodeAction(item.title); 90 const kind = client.protocol2CodeConverter.asCodeActionKind((item as any).kind);
91 const action = new vscode.CodeAction(item.title, kind);
91 const group = (item as any).group; 92 const group = (item as any).group;
92 const id = (item as any).id; 93 const id = (item as any).id;
93 const resolveParams: ra.ResolveCodeActionParams = { 94 const resolveParams: ra.ResolveCodeActionParams = {
@@ -116,6 +117,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
116 result[index] = items[0]; 117 result[index] = items[0];
117 } else { 118 } else {
118 const action = new vscode.CodeAction(group); 119 const action = new vscode.CodeAction(group);
120 action.kind = items[0].kind;
119 action.command = { 121 action.command = {
120 command: "rust-analyzer.applyActionGroup", 122 command: "rust-analyzer.applyActionGroup",
121 title: "", 123 title: "",