Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use label for "Follow link" command's tooltip #110917

Merged
merged 3 commits into from Nov 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/vs/editor/contrib/links/links.ts
Expand Up @@ -47,7 +47,17 @@ function getHoverMessage(link: Link, useMetaKey: boolean): MarkdownString {
: nls.localize('links.navigate.kb.alt', "alt + click");

if (link.url) {
const hoverMessage = new MarkdownString('', true).appendMarkdown(`[${label}](${link.url.toString()}) (${kb})`);
let nativeLabel = '';
if (/^command:/i.test(link.url.toString())) {
// Don't show complete command arguments in the native tooltip
const match = link.url.toString().match(/^command:([^?#]+)/);
if (match) {
const commandId = match[1];
const nativeLabelText = nls.localize('tooltip.explanation', "Execute command {0}", commandId);
nativeLabel = ` "${nativeLabelText}"`;
}
}
const hoverMessage = new MarkdownString('', true).appendMarkdown(`[${label}](${link.url.toString()}${nativeLabel}) (${kb})`);
return hoverMessage;
} else {
return new MarkdownString().appendText(`${label} (${kb})`);
Expand Down