@@ -721,6 +721,19 @@ export class ContentHoverWidget extends ResizableContentWidget {
721
721
// See https://github.com/microsoft/vscode/issues/140339
722
722
// TODO: Doing a second layout of the hover after force rendering the editor
723
723
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
+
724
737
if ( hoverData . stoleFocus ) {
725
738
this . _hover . containerDomNode . focus ( ) ;
726
739
}
@@ -757,12 +770,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
757
770
this . _setContentsDomNodeDimensions ( dom . getTotalWidth ( contentsDomNode ) , Math . min ( maxRenderingHeight , height - SCROLLBAR_WIDTH ) ) ;
758
771
}
759
772
760
- public onContentsChanged ( ) : void {
761
- this . _removeConstraintsRenderNormally ( ) ;
773
+ private _layoutWidget ( height : number , width : number ) {
762
774
const containerDomNode = this . _hover . containerDomNode ;
763
-
764
- let height = dom . getTotalHeight ( containerDomNode ) ;
765
- let width = dom . getTotalWidth ( containerDomNode ) ;
766
775
this . _resizableNode . layout ( height , width ) ;
767
776
768
777
this . _setHoverWidgetDimensions ( width , height ) ;
@@ -778,6 +787,12 @@ export class ContentHoverWidget extends ResizableContentWidget {
778
787
this . _layoutContentWidget ( ) ;
779
788
}
780
789
790
+ public onContentsChanged ( ) : void {
791
+ this . _removeConstraintsRenderNormally ( ) ;
792
+ const containerDomNode = this . _hover . containerDomNode ;
793
+ this . _layoutWidget ( dom . getTotalHeight ( containerDomNode ) , dom . getTotalWidth ( containerDomNode ) ) ;
794
+ }
795
+
781
796
public focus ( ) : void {
782
797
this . _hover . containerDomNode . focus ( ) ;
783
798
}
0 commit comments