提交 69bfc5af 编写于 作者: I isidor

debugHover: keep position prefence stable while shown

fixes #109226
上级 8bd3d7d7
......@@ -73,6 +73,7 @@ export class DebugHoverWidget implements IContentWidget {
private domNode!: HTMLElement;
private tree!: AsyncDataTree<IExpression, IExpression, any>;
private showAtPosition: Position | null;
private positionPreference: ContentWidgetPositionPreference[];
private highlightDecorations: string[];
private complexValueContainer!: HTMLElement;
private complexValueTitle!: HTMLElement;
......@@ -92,6 +93,7 @@ export class DebugHoverWidget implements IContentWidget {
this._isVisible = false;
this.showAtPosition = null;
this.highlightDecorations = [];
this.positionPreference = [ContentWidgetPositionPreference.ABOVE, ContentWidgetPositionPreference.BELOW];
}
private create(): void {
......@@ -304,6 +306,14 @@ export class DebugHoverWidget implements IContentWidget {
this.scrollbar.scanDomNode();
}
afterRender(positionPreference: ContentWidgetPositionPreference | null) {
if (positionPreference) {
// Remember where the editor placed you to keep position stable #109226
this.positionPreference = [positionPreference];
}
}
hide(): void {
if (!this._isVisible) {
return;
......@@ -316,15 +326,13 @@ export class DebugHoverWidget implements IContentWidget {
this.editor.deltaDecorations(this.highlightDecorations, []);
this.highlightDecorations = [];
this.editor.layoutContentWidget(this);
this.positionPreference = [ContentWidgetPositionPreference.ABOVE, ContentWidgetPositionPreference.BELOW];
}
getPosition(): IContentWidgetPosition | null {
return this._isVisible ? {
position: this.showAtPosition,
preference: [
ContentWidgetPositionPreference.ABOVE,
ContentWidgetPositionPreference.BELOW
]
preference: this.positionPreference
} : null;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册