aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/rust-analyzer/src/config.rs2
-rw-r--r--editors/code/src/client.ts17
2 files changed, 3 insertions, 16 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 14c4fe9ad..8d6efdbe8 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -349,7 +349,7 @@ impl Config {
349 self.assist.allow_snippets(snippet_text_edit); 349 self.assist.allow_snippets(snippet_text_edit);
350 350
351 self.client_caps.code_action_group = get_bool("codeActionGroup"); 351 self.client_caps.code_action_group = get_bool("codeActionGroup");
352 self.client_caps.resolve_code_action = get_bool("resolveCodeAction"); 352 self.client_caps.resolve_code_action = get_bool("resolveCodeAction");
353 self.client_caps.hover_actions = get_bool("hoverActions"); 353 self.client_caps.hover_actions = get_bool("hoverActions");
354 } 354 }
355 } 355 }
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index f2094b5ce..65ad573d8 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -7,20 +7,11 @@ import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.pr
7import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; 7import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed';
8import { assert } from './util'; 8import { assert } from './util';
9 9
10function toTrusted(obj: vscode.MarkedString): vscode.MarkedString { 10function renderCommand(cmd: ra.CommandLink) {
11 const md = <vscode.MarkdownString>obj;
12 if (md && md.value.includes("```rust")) {
13 md.isTrusted = true;
14 return md;
15 }
16 return obj;
17}
18
19function renderCommand(cmd: CommandLink) {
20 return `[${cmd.title}](command:${cmd.command}?${encodeURIComponent(JSON.stringify(cmd.arguments))} '${cmd.tooltip!}')`; 11 return `[${cmd.title}](command:${cmd.command}?${encodeURIComponent(JSON.stringify(cmd.arguments))} '${cmd.tooltip!}')`;
21} 12}
22 13
23function renderHoverActions(actions: CommandLinkGroup[]): vscode.MarkdownString { 14function renderHoverActions(actions: ra.CommandLinkGroup[]): vscode.MarkdownString {
24 const text = actions.map(group => 15 const text = actions.map(group =>
25 (group.title ? (group.title + " ") : "") + group.commands.map(renderCommand).join(' | ') 16 (group.title ? (group.title + " ") : "") + group.commands.map(renderCommand).join(' | ')
26 ).join('___'); 17 ).join('___');
@@ -63,10 +54,6 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
63 (result) => { 54 (result) => {
64 const hover = client.protocol2CodeConverter.asHover(result); 55 const hover = client.protocol2CodeConverter.asHover(result);
65 if (hover) { 56 if (hover) {
66 // Workaround to support command links (trusted vscode.MarkdownString) in hovers
67 // https://github.com/microsoft/vscode/issues/33577
68 hover.contents = hover.contents.map(toTrusted);
69
70 const actions = (<any>result).actions; 57 const actions = (<any>result).actions;
71 if (actions) { 58 if (actions) {
72 hover.contents.push(renderHoverActions(actions)); 59 hover.contents.push(renderHoverActions(actions));