diff options
author | Jeremy Kolb <[email protected]> | 2020-06-29 00:59:39 +0100 |
---|---|---|
committer | kjeremy <[email protected]> | 2020-07-02 22:13:03 +0100 |
commit | 5b9257561ff3bdf23ebcf3369f84283fb6c589a9 (patch) | |
tree | cf762a89c159c259d75f93fd9e437b50b0c45c4e /editors/code/src | |
parent | b98c16a034620913f3dbc67bd3f48ad2686face7 (diff) |
Pass CodeActionKind through our middleware to populate menus
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/client.ts | 6 |
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: "", |