Skip to content

Commit

Permalink
Merge pull request #110917 from dsanders11/patch-2
Browse files Browse the repository at this point in the history
Use label for "Follow link" command's tooltip
  • Loading branch information
alexdima committed Nov 20, 2020
2 parents cbeaf4f + 0ffe324 commit 87b8061
Showing 1 changed file with 11 additions and 1 deletion.
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

0 comments on commit 87b8061

Please sign in to comment.