@@ -30,7 +30,7 @@ export class ContentHoverController extends Disposable {
30
30
31
31
private readonly _participants : IEditorHoverParticipant [ ] ;
32
32
33
- private readonly _widget = this . _register ( this . _instantiationService . createInstance ( ContentHoverWidget , this . _editor ) ) ;
33
+ private readonly _widget : ContentHoverWidget ;
34
34
35
35
getWidgetContent ( ) : string | undefined {
36
36
const node = this . _widget . getDomNode ( ) ;
@@ -52,6 +52,11 @@ export class ContentHoverController extends Disposable {
52
52
) {
53
53
super ( ) ;
54
54
55
+ const initialHeight = this . _editor . getOption ( EditorOption . lineHeight ) + 8 ;
56
+ const initialWidth = 4 / 3 * initialHeight ;
57
+ const initialSize = new dom . Dimension ( initialWidth , initialHeight ) ;
58
+ this . _widget = this . _register ( this . _instantiationService . createInstance ( ContentHoverWidget , this . _editor , initialSize ) ) ;
59
+
55
60
// Instantiate participants and sort them by `hoverOrdinal` which is relevant for rendering order.
56
61
this . _participants = [ ] ;
57
62
for ( const participant of HoverParticipantRegistry . getAll ( ) ) {
@@ -481,9 +486,10 @@ export class ContentHoverWidget extends ResizableContentWidget {
481
486
482
487
constructor (
483
488
editor : ICodeEditor ,
489
+ initialSize : dom . Dimension ,
484
490
@IContextKeyService contextKeyService : IContextKeyService
485
491
) {
486
- super ( editor ) ;
492
+ super ( editor , initialSize ) ;
487
493
this . _hoverVisibleKey = EditorContextKeys . hoverVisible . bindTo ( contextKeyService ) ;
488
494
this . _hoverFocusedKey = EditorContextKeys . hoverFocused . bindTo ( contextKeyService ) ;
489
495
@@ -504,7 +510,6 @@ export class ContentHoverWidget extends ResizableContentWidget {
504
510
this . _hoverFocusedKey . set ( false ) ;
505
511
} ) ) ;
506
512
this . _setHoverData ( undefined ) ;
507
- this . _setMinimumDimensions ( ) ;
508
513
this . _layout ( ) ;
509
514
this . _editor . addContentWidget ( this ) ;
510
515
}
@@ -519,15 +524,6 @@ export class ContentHoverWidget extends ResizableContentWidget {
519
524
return ContentHoverWidget . ID ;
520
525
}
521
526
522
- private _setMinimumDimensions ( ) : void {
523
- const width = 50 ;
524
- const height = this . _editor . getOption ( EditorOption . lineHeight ) + 8 ;
525
- const contentsDomNode = this . _hover . contentsDomNode ;
526
- contentsDomNode . style . minWidth = width + 'px' ;
527
- contentsDomNode . style . minHeight = height + 'px' ;
528
- this . _resizableNode . minSize = new dom . Dimension ( width , height ) ;
529
- }
530
-
531
527
private static _applyDimensions ( container : HTMLElement , width : number | string , height : number | string ) : void {
532
528
const transformedWidth = typeof width === 'number' ? `${ width } px` : width ;
533
529
const transformedHeight = typeof height === 'number' ? `${ height } px` : height ;
0 commit comments