aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/client.ts17
1 files changed, 2 insertions, 15 deletions
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));