@@ -787,22 +787,22 @@ export class InteractiveEditorZoneWidget extends ZoneWidget {
787
787
super . _relayout ( this . _computeHeightInLines ( ) ) ;
788
788
}
789
789
790
- showWidget ( selectionRange : Range , position : Position | undefined ) : void {
791
- const widgetPosition = position ?? selectionRange . getEndPosition ( ) ;
790
+ showWidget ( position : Position ) : void {
791
+ const widgetPosition = position ;
792
+ console . log ( 'widgetPosition : ' , widgetPosition ) ;
792
793
super . show ( widgetPosition , this . _computeHeightInLines ( ) ) ;
793
794
this . widget . focus ( ) ;
794
795
this . _ctxVisible . set ( true ) ;
795
- this . _setMargins ( selectionRange , widgetPosition ) ;
796
+ this . _setMargins ( widgetPosition ) ;
796
797
}
797
798
798
- private _setMargins ( selectionRange : Range , position : Position ) : void {
799
- const positionLineNumber = position . lineNumber ;
800
- const info = this . editor . getLayoutInfo ( ) ;
801
- const startLineNumber = selectionRange . getStartPosition ( ) . lineNumber ;
799
+ private _setMargins ( position : Position ) : void {
802
800
const viewModel = this . editor . _getViewModel ( ) ;
803
801
if ( ! viewModel ) {
804
802
return ;
805
803
}
804
+ const positionLineNumber = position . lineNumber ;
805
+ const startLineNumber = viewModel . getCompletelyVisibleViewRange ( ) . startLineNumber ;
806
806
let indentationLineNumber ;
807
807
let indentationLevel ;
808
808
for ( let lineNumber = positionLineNumber ; lineNumber >= startLineNumber ; lineNumber -- ) {
@@ -814,6 +814,7 @@ export class InteractiveEditorZoneWidget extends ZoneWidget {
814
814
}
815
815
}
816
816
this . _indentationWidth = this . editor . getOffsetForColumn ( indentationLineNumber ?? positionLineNumber , indentationLevel ?? viewModel . getLineFirstNonWhitespaceColumn ( positionLineNumber ) ) ;
817
+ const info = this . editor . getLayoutInfo ( ) ;
817
818
const marginWithoutIndentation = info . glyphMarginWidth + info . decorationsWidth + info . lineNumbersWidth ;
818
819
const marginWithIndentation = marginWithoutIndentation + this . _indentationWidth ;
819
820
const isEnoughAvailableSpaceWithIndentation = this . _availableSpaceGivenIndentation ( ) > 400 ;
0 commit comments