Move statusBarItem onto new hoverService.setupUpdatableHover

This commit is contained in:
Daniel Imms 2024-04-03 06:35:42 -07:00
parent 815dcf06b5
commit f93eb1c974
No known key found for this signature in database
GPG key ID: E5CF412B63651C69
2 changed files with 5 additions and 2 deletions

View file

@ -187,6 +187,8 @@ export class HoverService extends Disposable implements IHoverService {
}
}
// TODO: Investigate performance of this function. There seems to be a lot of content created
// and thrown away on start up
setupUpdatableHover(hoverDelegate: IHoverDelegate, htmlElement: HTMLElement, content: IUpdatableHoverContentOrFactory, options?: IUpdatableHoverOptions | undefined): IUpdatableHover {
htmlElement.setAttribute('custom-hover', 'true');

View file

@ -21,11 +21,11 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
import { renderIcon, renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
import { spinningLoading, syncing } from 'vs/platform/theme/common/iconRegistry';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { isMarkdownString, markdownStringEqual } from 'vs/base/common/htmlContent';
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
import { Gesture, EventType as TouchEventType } from 'vs/base/browser/touch';
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
import { IHoverService } from 'vs/platform/hover/browser/hover';
export class StatusbarEntryItem extends Disposable {
@ -60,6 +60,7 @@ export class StatusbarEntryItem extends Disposable {
entry: IStatusbarEntry,
private readonly hoverDelegate: IHoverDelegate,
@ICommandService private readonly commandService: ICommandService,
@IHoverService private readonly hoverService: IHoverService,
@INotificationService private readonly notificationService: INotificationService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IThemeService private readonly themeService: IThemeService
@ -121,7 +122,7 @@ export class StatusbarEntryItem extends Disposable {
if (this.hover) {
this.hover.update(hoverContents);
} else {
this.hover = this._register(setupCustomHover(this.hoverDelegate, this.container, hoverContents));
this.hover = this._register(this.hoverService.setupUpdatableHover(this.hoverDelegate, this.container, hoverContents));
}
if (entry.command !== ShowTooltipCommand /* prevents flicker on click */) {
this.focusListener.value = addDisposableListener(this.labelContainer, EventType.FOCUS, e => {