Skip to content

Commit 0bdacdb

Browse files
committed
removing the position from the resizable content widget and adding it into the content hover
1 parent 36fd1e0 commit 0bdacdb

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ export class ContentHoverWidget extends ResizableContentWidget {
453453
private _disposableStore = new DisposableStore();
454454
private _visibleData: ContentHoverVisibleData | undefined;
455455
private _positionPreference: ContentWidgetPositionPreference | undefined;
456+
private _position: Position | undefined;
456457

457458
private readonly _hover: HoverWidget = this._disposableStore.add(new HoverWidget());
458459
private readonly _hoverVisibleKey: IContextKey<boolean>;
@@ -470,6 +471,14 @@ export class ContentHoverWidget extends ResizableContentWidget {
470471
return this._hoverVisibleKey.get() ?? false;
471472
}
472473

474+
get position(): Position | undefined {
475+
return this._position;
476+
}
477+
478+
set position(position: Position | undefined) {
479+
this._position = position;
480+
}
481+
473482
constructor(
474483
_editor: ICodeEditor,
475484
@IContextKeyService _contextKeyService: IContextKeyService
@@ -635,12 +644,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
635644
return true;
636645
}
637646

638-
private _setWidgetPosition(position: Position | undefined) {
639-
this._position = position;
640-
}
641-
642647
private _setHoverData(hoverData: ContentHoverVisibleData | undefined): void {
643-
this._setWidgetPosition(hoverData?.showAtPosition);
648+
this._position = hoverData?.showAtPosition;
644649
this._visibleData?.disposables.dispose();
645650
this._visibleData = hoverData;
646651
this._hoverVisibleKey.set(!!hoverData);

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
88
import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition } from 'vs/editor/browser/editorBrowser';
99
import { EditorOption } from 'vs/editor/common/config/editorOptions';
1010
import { clamp } from 'vs/base/common/numbers';
11-
import { IPosition, Position } from 'vs/editor/common/core/position';
11+
import { IPosition } from 'vs/editor/common/core/position';
1212
import * as dom from 'vs/base/browser/dom';
1313

1414
const HEADER_HEIGHT = 30;
@@ -21,7 +21,6 @@ export abstract class ResizableContentWidget extends Disposable implements ICont
2121

2222
protected readonly _resizableNode = this._register(new ResizableHTMLElement());
2323
protected _contentPosition: IContentWidgetPosition | null = null;
24-
protected _position: Position | undefined;
2524

2625
private _isResizing: boolean = false;
2726

@@ -59,14 +58,6 @@ export abstract class ResizableContentWidget extends Disposable implements ICont
5958
return this._contentPosition;
6059
}
6160

62-
get position(): Position | undefined {
63-
return this._position;
64-
}
65-
66-
set position(position: Position | undefined) {
67-
this._position = position;
68-
}
69-
7061
protected _availableVerticalSpaceAbove(position: IPosition): number | undefined {
7162
const editorDomNode = this._editor.getDomNode();
7263
const mouseBox = this._editor.getScrolledVisiblePosition(position);

0 commit comments

Comments
 (0)