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

Mimic status bar hover delay in explorer #174497

Merged
merged 1 commit into from Feb 15, 2023
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
10 changes: 10 additions & 0 deletions src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
Expand Up @@ -280,9 +280,15 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu

private readonly hoverDelegate = new class implements IHoverDelegate {

private lastHoverHideTime = 0;
readonly placement = 'element';

get delay() {
// Delay implementation borrowed froms src/vs/workbench/browser/parts/statusbar/statusbarPart.ts
if (Date.now() - this.lastHoverHideTime < 200) {
return 0; // show instantly when a hover was recently shown
}

return this.configurationService.getValue<number>('workbench.hover.delay');
}

Expand Down Expand Up @@ -334,6 +340,10 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu
hoverPosition: HoverPosition.RIGHT,
}, focus) : undefined;
}

onDidHideHover(): void {
this.lastHoverHideTime = Date.now();
}
}(this.configurationService, this.hoverService);

constructor(
Expand Down