Skip to content

Commit 118be5c

Browse files
committed
just changing the maximum rendering width to make it larger
1 parent c092aeb commit 118be5c

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

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

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,11 @@ export class ContentHoverWidget extends ResizableContentWidget {
618618
if (!this._editor || !this._editor.hasModel()) {
619619
return;
620620
}
621-
const editorBox = dom.getDomNodePagePosition(this._editor.getDomNode());
622-
const glyphMarginWidth = this._editor.getLayoutInfo().glyphMarginWidth;
623-
const leftOfContainer = this._hover.containerDomNode.offsetLeft;
624-
return editorBox.width + editorBox.left - leftOfContainer - glyphMarginWidth;
621+
const editorLayoutInfo = this._editor.getLayoutInfo();
622+
const glyphMarginRight = editorLayoutInfo.glyphMarginLeft + editorLayoutInfo.glyphMarginWidth;
623+
const cursorPosition = this._editor._getViewModel().getPrimaryCursorState().viewState.position;
624+
const bodyBoxWidth = dom.getClientArea(document.body).width;
625+
return bodyBoxWidth - glyphMarginRight - this._editor.getOffsetForColumn(cursorPosition.lineNumber, cursorPosition.column);
625626
}
626627

627628
public isMouseGettingCloser(posx: number, posy: number): boolean {
@@ -721,19 +722,6 @@ export class ContentHoverWidget extends ResizableContentWidget {
721722
// See https://github.com/microsoft/vscode/issues/140339
722723
// TODO: Doing a second layout of the hover after force rendering the editor
723724
this.onContentsChanged();
724-
725-
// If the normal rendering dimensions surpass the resizable node max dimensions
726-
// then update the dimensions of the hover
727-
this._setResizableNodeMaxDimensions();
728-
const containerDomNode = this._hover.containerDomNode;
729-
const currentHeight = containerDomNode.clientHeight;
730-
const currentWidth = containerDomNode.clientWidth;
731-
const maxHeight = Math.min(this._resizableNode.maxSize.height, currentHeight);
732-
const maxWidth = Math.min(this._resizableNode.maxSize.width, currentWidth);
733-
if (currentHeight >= maxHeight || currentWidth >= maxWidth) {
734-
this._layoutWidget(maxHeight, maxWidth);
735-
}
736-
737725
if (hoverData.stoleFocus) {
738726
this._hover.containerDomNode.focus();
739727
}
@@ -770,8 +758,12 @@ export class ContentHoverWidget extends ResizableContentWidget {
770758
this._setContentsDomNodeDimensions(dom.getTotalWidth(contentsDomNode), Math.min(maxRenderingHeight, height - SCROLLBAR_WIDTH));
771759
}
772760

773-
private _layoutWidget(height: number, width: number) {
761+
public onContentsChanged(): void {
762+
this._removeConstraintsRenderNormally();
774763
const containerDomNode = this._hover.containerDomNode;
764+
765+
let height = dom.getTotalHeight(containerDomNode);
766+
let width = dom.getTotalWidth(containerDomNode);
775767
this._resizableNode.layout(height, width);
776768

777769
this._setHoverWidgetDimensions(width, height);
@@ -787,12 +779,6 @@ export class ContentHoverWidget extends ResizableContentWidget {
787779
this._layoutContentWidget();
788780
}
789781

790-
public onContentsChanged(): void {
791-
this._removeConstraintsRenderNormally();
792-
const containerDomNode = this._hover.containerDomNode;
793-
this._layoutWidget(dom.getTotalHeight(containerDomNode), dom.getTotalWidth(containerDomNode));
794-
}
795-
796782
public focus(): void {
797783
this._hover.containerDomNode.focus();
798784
}

0 commit comments

Comments
 (0)