@@ -23,7 +23,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
23
23
import { AsyncIterableObject } from 'vs/base/common/async' ;
24
24
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys' ;
25
25
import { IContextKey , IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
26
- import { MultiplePersistedSizeResizableContentWidget } from 'vs/editor/contrib/hover/browser/resizableContentWidget' ;
26
+ import { ResizableContentWidget } from 'vs/editor/contrib/hover/browser/resizableContentWidget' ;
27
27
const $ = dom . $ ;
28
28
29
29
export class ContentHoverController extends Disposable {
@@ -389,10 +389,6 @@ export class ContentHoverController extends Disposable {
389
389
public escape ( ) : void {
390
390
this . _widget . escape ( ) ;
391
391
}
392
-
393
- public clearPersistedSizes ( ) : void {
394
- this . _widget ?. clearPersistedSizes ( ) ;
395
- }
396
392
}
397
393
398
394
class HoverResult {
@@ -450,7 +446,7 @@ const HORIZONTAL_SCROLLING_BY = 30;
450
446
const SCROLLBAR_WIDTH = 10 ;
451
447
const SASH_WIDTH_MINUS_BORDER = 3 ;
452
448
453
- export class ResizableHoverWidget extends MultiplePersistedSizeResizableContentWidget {
449
+ export class ResizableHoverWidget extends ResizableContentWidget {
454
450
455
451
public static ID = 'editor.contrib.resizableContentHoverWidget' ;
456
452
@@ -591,10 +587,6 @@ export class ResizableHoverWidget extends MultiplePersistedSizeResizableContentW
591
587
return this . _positionPreference === ContentWidgetPositionPreference . ABOVE ? this . _availableVerticalSpaceAbove ( position ) : this . _availableVerticalSpaceBelow ( position ) ;
592
588
}
593
589
594
- private _findAvailableSpaceHorizontally ( ) : number | undefined {
595
- return this . _findMaximumRenderingWidth ( ) ;
596
- }
597
-
598
590
private _findMaximumRenderingHeight ( ) : number | undefined {
599
591
const availableSpace = this . _findAvailableSpaceVertically ( ) ;
600
592
if ( ! availableSpace ) {
@@ -677,9 +669,7 @@ export class ResizableHoverWidget extends MultiplePersistedSizeResizableContentW
677
669
}
678
670
679
671
private _getWidgetHeight ( ) : number {
680
- const containerDomNode = this . _hoverWidget . containerDomNode ;
681
- const persistedSize = this . findPersistedSize ( ) ;
682
- return persistedSize ? persistedSize . height : containerDomNode . clientHeight + 2 * SASH_WIDTH_MINUS_BORDER ;
672
+ return this . _hoverWidget . containerDomNode . clientHeight + 2 * SASH_WIDTH_MINUS_BORDER ;
683
673
}
684
674
685
675
private _layoutContentWidget ( ) : void {
@@ -688,9 +678,8 @@ export class ResizableHoverWidget extends MultiplePersistedSizeResizableContentW
688
678
}
689
679
690
680
private _updateContentsDomNodeMaxDimensions ( ) {
691
- const persistedSize = this . findPersistedSize ( ) ;
692
- const width = persistedSize ? 'none' : Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 ) ;
693
- const height = persistedSize ? 'none' : Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 ) ;
681
+ const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 ) ;
682
+ const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 ) ;
694
683
this . _setContentsDomNodeMaxDimensions ( width , height ) ;
695
684
}
696
685
@@ -753,22 +742,10 @@ export class ResizableHoverWidget extends MultiplePersistedSizeResizableContentW
753
742
}
754
743
755
744
private _setPersistedHoverDimensionsOrRenderNormally ( ) : void {
756
- let width : number | string ;
757
- let height : number | string ;
758
- const persistedSize = this . findPersistedSize ( ) ;
759
- // Suppose a persisted size is defined
760
- if ( persistedSize ) {
761
- const totalBorderWidth = 2 * SASH_WIDTH_MINUS_BORDER ;
762
- width = Math . min ( this . _findAvailableSpaceHorizontally ( ) ?? Infinity , persistedSize . width - totalBorderWidth ) ;
763
- height = Math . min ( this . _findAvailableSpaceVertically ( ) ?? Infinity , persistedSize . height - totalBorderWidth ) ;
764
- } else {
765
- // Added because otherwise the initial size of the hover content is smaller than should be
766
- const layoutInfo = this . _editor . getLayoutInfo ( ) ;
767
- this . _resizableNode . layout ( layoutInfo . height , layoutInfo . width ) ;
768
- width = 'auto' ;
769
- height = 'auto' ;
770
- }
771
- this . _setHoverWidgetDimensions ( width , height ) ;
745
+ // Added because otherwise the initial size of the hover content is smaller than should be
746
+ const layoutInfo = this . _editor . getLayoutInfo ( ) ;
747
+ this . _resizableNode . layout ( layoutInfo . height , layoutInfo . width ) ;
748
+ this . _setHoverWidgetDimensions ( 'auto' , 'auto' ) ;
772
749
}
773
750
774
751
private _setContainerAbsolutePosition ( top : number , left : number ) : void {
0 commit comments