mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 17:33:07 +00:00
Remove hover contents marking as trusted.
Hover contents might be extracted from raw doc comments and need some validation.
This commit is contained in:
parent
0fe43a124b
commit
78c9223b7b
@ -349,7 +349,7 @@ impl Config {
|
||||
self.assist.allow_snippets(snippet_text_edit);
|
||||
|
||||
self.client_caps.code_action_group = get_bool("codeActionGroup");
|
||||
self.client_caps.resolve_code_action = get_bool("resolveCodeAction");
|
||||
self.client_caps.resolve_code_action = get_bool("resolveCodeAction");
|
||||
self.client_caps.hover_actions = get_bool("hoverActions");
|
||||
}
|
||||
}
|
||||
|
@ -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 = <vscode.MarkdownString>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 = (<any>result).actions;
|
||||
if (actions) {
|
||||
hover.contents.push(renderHoverActions(actions));
|
||||
|
Loading…
Reference in New Issue
Block a user