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
Workbench hover to align and correctly apply delay setting #204871
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for driving this.
I think there are a lot more places where the custom hover is installed where maybe we could think about more reuse. To give some examples:
vscode/src/vs/workbench/browser/parts/statusbar/statusbarPart.ts
Lines 147 to 153 in ec85082
get delay() { | |
if (Date.now() - this.lastHoverHideTime < 200) { | |
return 0; // show instantly when a hover was recently shown | |
} | |
return this.configurationService.getValue<number>('workbench.hover.delay'); | |
} |
export function setupCustomHover(hoverDelegate: IHoverDelegate, htmlElement: HTMLElement, content: IHoverContent, options?: IUpdatableHoverOptions): ICustomHover { |
Adopted it in further cases. I extended it to also be able to enable if the hover should instantly be shown after hovering over another element. Also the consumer can now add options to override the defaults. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have feedback, but will file a new issue.
This PR refactors the usage of the hover service across various components. Instead of directly using the hover service, a new
WorkbenchHoverDelegate
is created and used. This delegate encapsulates the hover service and provides a consistent interface for components to use. This change simplifies the code and makes it easier to manage hover behavior across the workbench. Compared to the previous implementation, the delay will adapt when the configuration is changed without having to reload.