Skip to content

Commit

Permalink
Better match native hover delay in custom tree hovers
Browse files Browse the repository at this point in the history
Fixes #106102
  • Loading branch information
alexr00 committed Sep 4, 2020
1 parent 7bbd494 commit ffae04a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/vs/workbench/contrib/views/browser/treeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { SIDE_BAR_BACKGROUND, PANEL_BACKGROUND } from 'vs/workbench/common/theme
import { IHoverService, IHoverOptions, IHoverTarget } from 'vs/workbench/services/hover/browser/hover';
import { ActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { IMarkdownString } from 'vs/base/common/htmlContent';
import { isMacintosh } from 'vs/base/common/platform';

class Root implements ITreeItem {
label = { label: 'root' };
Expand Down Expand Up @@ -809,7 +810,9 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS

private setupHovers(node: ITreeItem, htmlElement: HTMLElement, disposableStore: DisposableStore, label: string | undefined): void {
const hoverService = this.hoverService;
const hoverDelay = this.hoverDelay;
// Testing has indicated that on Windows and Linux 500 ms matches the native hovers most closely.
// On Mac, the delay is 1500.
const hoverDelay = isMacintosh ? 1500 : 500;
let hoverOptions: IHoverOptions | undefined;
let mouseX: number | undefined;
function mouseOver(this: HTMLElement, e: MouseEvent): any {
Expand Down

0 comments on commit ffae04a

Please sign in to comment.