@@ -601,9 +601,9 @@ export class ResizableHoverWidget extends MultiplePersistedSizeResizableContentW
601
601
return ;
602
602
}
603
603
let maximumHeight = 3 * SASH_WIDTH_MINUS_BORDER ;
604
- for ( const hoverPart of this . _hoverWidget . contentsDomNode . children ) {
604
+ Array . from ( this . _hoverWidget . contentsDomNode . children ) . forEach ( ( hoverPart ) => {
605
605
maximumHeight += hoverPart . clientHeight ;
606
- }
606
+ } ) ;
607
607
if ( this . _hasHorizontalScrollbar ( ) ) {
608
608
maximumHeight += SCROLLBAR_WIDTH ;
609
609
}
@@ -615,11 +615,9 @@ export class ResizableHoverWidget extends MultiplePersistedSizeResizableContentW
615
615
return ;
616
616
}
617
617
const editorBox = dom . getDomNodePagePosition ( this . _editor . getDomNode ( ) ) ;
618
- const widthOfEditor = editorBox . width ;
619
- const leftOfEditor = editorBox . left ;
620
618
const glyphMarginWidth = this . _editor . getLayoutInfo ( ) . glyphMarginWidth ;
621
619
const leftOfContainer = this . _hoverWidget . containerDomNode . offsetLeft ;
622
- return widthOfEditor + leftOfEditor - leftOfContainer - glyphMarginWidth ;
620
+ return editorBox . width + editorBox . left - leftOfContainer - glyphMarginWidth ;
623
621
}
624
622
625
623
public isMouseGettingCloser ( posx : number , posy : number ) : boolean {
@@ -645,18 +643,21 @@ export class ResizableHoverWidget extends MultiplePersistedSizeResizableContentW
645
643
return true ;
646
644
}
647
645
646
+ private _setWidgetPosition ( position : Position | undefined ) {
647
+ this . _position = position ;
648
+ }
649
+
648
650
private _setVisibleData ( visibleData : ContentHoverData | undefined ) : void {
649
- this . _position = visibleData ?. showAtPosition ;
651
+ this . _setWidgetPosition ( visibleData ?. showAtPosition ) ;
650
652
this . _visibleData ?. disposables . dispose ( ) ;
651
653
this . _visibleData = visibleData ;
652
- this . _hoverVisibleKey . set ( ! ! this . _visibleData ) ;
653
- this . _hoverWidget . containerDomNode . classList . toggle ( 'hidden' , ! this . _visibleData ) ;
654
+ this . _hoverVisibleKey . set ( ! ! visibleData ) ;
655
+ this . _hoverWidget . containerDomNode . classList . toggle ( 'hidden' , ! visibleData ) ;
654
656
}
655
657
656
658
private _layout ( ) : void {
657
659
const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 ) ;
658
660
const { fontSize, lineHeight } = this . _editor . getOption ( EditorOption . fontInfo ) ;
659
-
660
661
const contentsDomNode = this . _hoverWidget . contentsDomNode ;
661
662
contentsDomNode . style . fontSize = `${ fontSize } px` ;
662
663
contentsDomNode . style . lineHeight = `${ lineHeight / fontSize } ` ;
@@ -678,12 +679,7 @@ export class ResizableHoverWidget extends MultiplePersistedSizeResizableContentW
678
679
private _getWidgetHeight ( ) : number {
679
680
const containerDomNode = this . _hoverWidget . containerDomNode ;
680
681
const persistedSize = this . findPersistedSize ( ) ;
681
- if ( ! persistedSize ) {
682
- return containerDomNode . clientHeight + 2 * SASH_WIDTH_MINUS_BORDER ;
683
- }
684
- else {
685
- return persistedSize . height ;
686
- }
682
+ return persistedSize ? persistedSize . height : containerDomNode . clientHeight + 2 * SASH_WIDTH_MINUS_BORDER ;
687
683
}
688
684
689
685
private _layoutContentWidget ( ) : void {
0 commit comments