Skip to content

Commit 78c9223

Browse files
committed
Remove hover contents marking as trusted.
Hover contents might be extracted from raw doc comments and need some validation.
1 parent 0fe43a1 commit 78c9223

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ impl Config {
349349
self.assist.allow_snippets(snippet_text_edit);
350350

351351
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");
353353
self.client_caps.hover_actions = get_bool("hoverActions");
354354
}
355355
}

editors/code/src/client.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,11 @@ import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.pr
77
import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed';
88
import { assert } from './util';
99

10-
function toTrusted(obj: vscode.MarkedString): vscode.MarkedString {
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-
19-
function renderCommand(cmd: CommandLink) {
10+
function renderCommand(cmd: ra.CommandLink) {
2011
return `[${cmd.title}](command:${cmd.command}?${encodeURIComponent(JSON.stringify(cmd.arguments))} '${cmd.tooltip!}')`;
2112
}
2213

23-
function renderHoverActions(actions: CommandLinkGroup[]): vscode.MarkdownString {
14+
function renderHoverActions(actions: ra.CommandLinkGroup[]): vscode.MarkdownString {
2415
const text = actions.map(group =>
2516
(group.title ? (group.title + " ") : "") + group.commands.map(renderCommand).join(' | ')
2617
).join('___');
@@ -63,10 +54,6 @@ export function createClient(serverPath: string, cwd: string): lc.LanguageClient
6354
(result) => {
6455
const hover = client.protocol2CodeConverter.asHover(result);
6556
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-
7057
const actions = (<any>result).actions;
7158
if (actions) {
7259
hover.contents.push(renderHoverActions(actions));

0 commit comments

Comments
 (0)