Skip to content

Commit 4291d2b

Browse files
authored
Enable resource decorations for some tree tooltips (microsoft#158593)
Part of microsoft/vscode-pull-request-github#3644
1 parent 866bddc commit 4291d2b

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/vs/workbench/browser/labels.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,13 @@ class ResourceLabelWidget extends IconLabel {
587587

588588
const decoration = this.decoration.value;
589589
if (decoration) {
590-
if (decoration.tooltip && (typeof iconLabelOptions.title === 'string')) {
591-
iconLabelOptions.title = `${iconLabelOptions.title}${decoration.tooltip}`;
590+
if (decoration.tooltip) {
591+
if (typeof iconLabelOptions.title === 'string') {
592+
iconLabelOptions.title = `${iconLabelOptions.title}${decoration.tooltip}`;
593+
} else if (typeof iconLabelOptions.title?.markdown === 'string') {
594+
const title = `${iconLabelOptions.title.markdown}${decoration.tooltip}`;
595+
iconLabelOptions.title = { markdown: title, markdownNotSupportedFallback: title };
596+
}
592597
}
593598

594599
if (decoration.strikethrough) {

src/vs/workbench/browser/parts/views/treeView.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,11 +1010,12 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
10101010
}
10111011

10121012
return {
1013-
markdown: (token: CancellationToken): Promise<IMarkdownString | string | undefined> => {
1014-
return new Promise<IMarkdownString | string | undefined>((resolve) => {
1015-
node.resolve(token).then(() => resolve(node.tooltip));
1016-
});
1017-
},
1013+
markdown: typeof node.tooltip === 'string' ? node.tooltip :
1014+
(token: CancellationToken): Promise<IMarkdownString | string | undefined> => {
1015+
return new Promise<IMarkdownString | string | undefined>((resolve) => {
1016+
node.resolve(token).then(() => resolve(node.tooltip));
1017+
});
1018+
},
10181019
markdownNotSupportedFallback: resource ? undefined : (label ?? '') // Passing undefined as the fallback for a resource falls back to the old native hover
10191020
};
10201021
}

0 commit comments

Comments
 (0)