Skip to content

Commit

Permalink
Always use new hover in custom tree views
Browse files Browse the repository at this point in the history
  • Loading branch information
alexr00 committed Aug 27, 2020
1 parent d82329c commit 874c98d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/vs/workbench/contrib/views/browser/treeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
const fileDecorations = this.configurationService.getValue<{ colors: boolean, badges: boolean }>('explorer.decorations');
templateData.resourceLabel.setResource({ name: label, description, resource: resource ? resource : URI.parse('missing:_icon_resource') }, {
fileKind: this.getFileKind(node),
title,
title: undefined,
hideIcon: !!iconUrl,
fileDecorations,
extraClasses: ['custom-view-tree-node-item-resourceLabel'],
Expand All @@ -775,7 +775,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
});
} else {
templateData.resourceLabel.setResource({ name: label, description }, {
title,
title: undefined,
hideIcon: true,
extraClasses: ['custom-view-tree-node-item-resourceLabel'],
matches: matches ? matches : createMatches(element.filterData),
Expand Down Expand Up @@ -811,10 +811,6 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
}

private setupHovers(node: ITreeItem, htmlElement: HTMLElement, disposableStore: DisposableStore, label: string | undefined): void {
if (!(node instanceof ResolvableTreeItem) || (node.tooltip && isString(node.tooltip)) || (!node.tooltip && !node.hasResolve)) {
return;
}
const resolvableNode: ResolvableTreeItem = node;
const hoverService = this.hoverService;
const hoverDelay = this.hoverDelay;
let hoverOptions: IHoverOptions | undefined;
Expand All @@ -825,8 +821,10 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
}
this.addEventListener(DOM.EventType.MOUSE_LEAVE, mouseLeave, { passive: true });
setTimeout(async () => {
await resolvableNode.resolve();
const tooltip = resolvableNode.tooltip ?? label;
if (node instanceof ResolvableTreeItem) {
await node.resolve();
}
const tooltip = node.tooltip ?? label;
if (isHovering && tooltip) {
if (!hoverOptions) {
const target: IHoverTarget = {
Expand Down

0 comments on commit 874c98d

Please sign in to comment.