From 78c9223b7bd4bffe64b7ec69e5fee08604dc0057 Mon Sep 17 00:00:00 2001 From: vsrs Date: Fri, 5 Jun 2020 15:25:01 +0300 Subject: Remove hover contents marking as trusted. Hover contents might be extracted from raw doc comments and need some validation. --- editors/code/src/client.ts | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'editors') 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 import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; import { assert } from './util'; -function toTrusted(obj: vscode.MarkedString): vscode.MarkedString { - const md = obj; - if (md && md.value.includes("```rust")) { - md.isTrusted = true; - return md; - } - return obj; -} - -function renderCommand(cmd: CommandLink) { +function renderCommand(cmd: ra.CommandLink) { return `[${cmd.title}](command:${cmd.command}?${encodeURIComponent(JSON.stringify(cmd.arguments))} '${cmd.tooltip!}')`; } -function renderHoverActions(actions: CommandLinkGroup[]): vscode.MarkdownString { +function renderHoverActions(actions: ra.CommandLinkGroup[]): vscode.MarkdownString { const text = actions.map(group => (group.title ? (group.title + " ") : "") + group.commands.map(renderCommand).join(' | ') ).join('___'); @@ -63,10 +54,6 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient (result) => { const hover = client.protocol2CodeConverter.asHover(result); if (hover) { - // Workaround to support command links (trusted vscode.MarkdownString) in hovers - // https://github.com/microsoft/vscode/issues/33577 - hover.contents = hover.contents.map(toTrusted); - const actions = (result).actions; if (actions) { hover.contents.push(renderHoverActions(actions)); -- cgit v1.2.3