aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/client.ts
diff options
context:
space:
mode:
authorZac Pullar-Strecker <[email protected]>2020-07-31 03:12:44 +0100
committerZac Pullar-Strecker <[email protected]>2020-07-31 03:12:44 +0100
commitf05d7b41a719d848844b054a16477b29d0f063c6 (patch)
tree0a8a0946e8aef2ce64d4c13d0035ba41cce2daf3 /editors/code/src/client.ts
parent73ff610e41959e3e7c78a2b4b25b086883132956 (diff)
parent6b7cb8b5ab539fc4333ce34bc29bf77c976f232a (diff)
Merge remote-tracking branch 'upstream/master' into 503-hover-doc-links
Hasn't fixed tests yet.
Diffstat (limited to 'editors/code/src/client.ts')
-rw-r--r--editors/code/src/client.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index 65ad573d8..18948cb3c 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -41,6 +41,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
41 const clientOptions: lc.LanguageClientOptions = { 41 const clientOptions: lc.LanguageClientOptions = {
42 documentSelector: [{ scheme: 'file', language: 'rust' }], 42 documentSelector: [{ scheme: 'file', language: 'rust' }],
43 initializationOptions: vscode.workspace.getConfiguration("rust-analyzer"), 43 initializationOptions: vscode.workspace.getConfiguration("rust-analyzer"),
44 diagnosticCollectionName: "rustc",
44 traceOutputChannel, 45 traceOutputChannel,
45 middleware: { 46 middleware: {
46 // Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576 47 // Workaround for https://github.com/microsoft/vscode-languageserver-node/issues/576
@@ -66,7 +67,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
66 return Promise.resolve(null); 67 return Promise.resolve(null);
67 }); 68 });
68 }, 69 },
69 // Using custom handling of CodeActions where each code action is resloved lazily 70 // 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 71 // 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) { 72 async provideCodeActions(document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken, _next: lc.ProvideCodeActionsSignature) {
72 const params: lc.CodeActionParams = { 73 const params: lc.CodeActionParams = {
@@ -87,7 +88,8 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
87 continue; 88 continue;
88 } 89 }
89 assert(isCodeActionWithoutEditsAndCommands(item), "We don't expect edits or commands here"); 90 assert(isCodeActionWithoutEditsAndCommands(item), "We don't expect edits or commands here");
90 const action = new vscode.CodeAction(item.title); 91 const kind = client.protocol2CodeConverter.asCodeActionKind((item as any).kind);
92 const action = new vscode.CodeAction(item.title, kind);
91 const group = (item as any).group; 93 const group = (item as any).group;
92 const id = (item as any).id; 94 const id = (item as any).id;
93 const resolveParams: ra.ResolveCodeActionParams = { 95 const resolveParams: ra.ResolveCodeActionParams = {
@@ -116,6 +118,7 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
116 result[index] = items[0]; 118 result[index] = items[0];
117 } else { 119 } else {
118 const action = new vscode.CodeAction(group); 120 const action = new vscode.CodeAction(group);
121 action.kind = items[0].kind;
119 action.command = { 122 action.command = {
120 command: "rust-analyzer.applyActionGroup", 123 command: "rust-analyzer.applyActionGroup",
121 title: "", 124 title: "",
@@ -161,6 +164,7 @@ class ExperimentalFeatures implements lc.StaticFeature {
161 caps.codeActionGroup = true; 164 caps.codeActionGroup = true;
162 caps.resolveCodeAction = true; 165 caps.resolveCodeAction = true;
163 caps.hoverActions = true; 166 caps.hoverActions = true;
167 caps.statusNotification = true;
164 capabilities.experimental = caps; 168 capabilities.experimental = caps;
165 } 169 }
166 initialize(_capabilities: lc.ServerCapabilities<any>, _documentSelector: lc.DocumentSelector | undefined): void { 170 initialize(_capabilities: lc.ServerCapabilities<any>, _documentSelector: lc.DocumentSelector | undefined): void {