Skip to content

Commit 2e83346

Browse files
committed
using the register function instead of using the additional disposable store
1 parent 8755ad6 commit 2e83346

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/vs/editor/contrib/hover/browser/contentHover.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,11 @@ export class ContentHoverWidget extends ResizableContentWidget {
450450

451451
public static ID = 'editor.contrib.resizableContentHoverWidget';
452452

453-
private _disposableStore = new DisposableStore();
454453
private _visibleData: ContentHoverVisibleData | undefined;
455454
private _positionPreference: ContentWidgetPositionPreference | undefined;
456455
private _position: Position | undefined;
457456

458-
private readonly _hover: HoverWidget = this._disposableStore.add(new HoverWidget());
457+
private readonly _hover: HoverWidget = this._register(new HoverWidget());
459458
private readonly _hoverVisibleKey: IContextKey<boolean>;
460459
private readonly _hoverFocusedKey: IContextKey<boolean>;
461460

@@ -490,17 +489,17 @@ export class ContentHoverWidget extends ResizableContentWidget {
490489
dom.append(this._resizableNode.domNode, this._hover.containerDomNode);
491490
this._resizableNode.domNode.style.zIndex = '50';
492491

493-
this._disposableStore.add(this._editor.onDidLayoutChange(() => this._layout()));
494-
this._disposableStore.add(this._editor.onDidChangeConfiguration((e: ConfigurationChangedEvent) => {
492+
this._register(this._editor.onDidLayoutChange(() => this._layout()));
493+
this._register(this._editor.onDidChangeConfiguration((e: ConfigurationChangedEvent) => {
495494
if (e.hasChanged(EditorOption.fontInfo)) {
496495
this._updateFont();
497496
}
498497
}));
499-
const focusTracker = this._disposableStore.add(dom.trackFocus(this._resizableNode.domNode));
500-
this._disposableStore.add(focusTracker.onDidFocus(() => {
498+
const focusTracker = this._register(dom.trackFocus(this._resizableNode.domNode));
499+
this._register(focusTracker.onDidFocus(() => {
501500
this._hoverFocusedKey.set(true);
502501
}));
503-
this._disposableStore.add(focusTracker.onDidBlur(() => {
502+
this._register(focusTracker.onDidBlur(() => {
504503
this._hoverFocusedKey.set(false);
505504
}));
506505
this._setHoverData(undefined);
@@ -510,7 +509,6 @@ export class ContentHoverWidget extends ResizableContentWidget {
510509
public override dispose(): void {
511510
super.dispose();
512511
this._visibleData?.disposables.dispose();
513-
this._disposableStore.dispose();
514512
this._editor.removeContentWidget(this);
515513
}
516514

0 commit comments

Comments
 (0)