@@ -26,7 +26,7 @@ import { EmbeddedCodeEditorWidget, EmbeddedDiffEditorWidget } from 'vs/editor/br
26
26
import { HiddenItemStrategy , MenuWorkbenchToolBar } from 'vs/platform/actions/browser/toolbar' ;
27
27
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar' ;
28
28
import { SuggestController } from 'vs/editor/contrib/suggest/browser/suggestController' ;
29
- import { Position } from 'vs/editor/common/core/position' ;
29
+ import { IPosition , Position } from 'vs/editor/common/core/position' ;
30
30
import { DEFAULT_FONT_FAMILY } from 'vs/workbench/browser/style' ;
31
31
import { DropdownWithDefaultActionViewItem , IMenuEntryActionViewItemOptions , MenuEntryActionViewItem , createActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem' ;
32
32
import { CompletionItem , CompletionItemInsertTextRule , CompletionItemKind , CompletionItemProvider , CompletionList , ProviderResult , TextEdit } from 'vs/editor/common/languages' ;
@@ -183,7 +183,6 @@ export class InteractiveEditorWidget {
183
183
private _isLayouting : boolean = false ;
184
184
private _preferredExpansionState : ExpansionState | undefined ;
185
185
private _expansionState : ExpansionState = ExpansionState . NOT_CROPPED ;
186
- private _indentationWidth : number = 0 ;
187
186
188
187
constructor (
189
188
private readonly parentEditor : ICodeEditor ,
@@ -465,14 +464,6 @@ export class InteractiveEditorWidget {
465
464
this . _preferredExpansionState = expansionState ;
466
465
}
467
466
468
- set indentationWidth ( indentationWidth : number ) {
469
- this . _indentationWidth = indentationWidth ;
470
- }
471
-
472
- get indentationWidth ( ) : number {
473
- return this . _indentationWidth ;
474
- }
475
-
476
467
updateMarkdownMessage ( message : Node | undefined ) {
477
468
this . _elements . markdownMessage . classList . toggle ( 'hidden' , ! message ) ;
478
469
let expansionState : ExpansionState ;
@@ -772,9 +763,14 @@ export class InteractiveEditorZoneWidget extends ZoneWidget {
772
763
protected override _doLayout ( heightInPixel : number ) : void {
773
764
774
765
const info = this . editor . getLayoutInfo ( ) ;
766
+ const spaceLeft = info . lineNumbersWidth + info . glyphMarginWidth + info . decorationsWidth ;
767
+ const spaceRight = info . minimap . minimapWidth + info . verticalScrollbarWidth ;
768
+
775
769
const maxWidth = ! this . widget . showsAnyPreview ( ) ? 640 : Number . MAX_SAFE_INTEGER ;
776
- const width = Math . min ( maxWidth , info . contentWidth - ( info . glyphMarginWidth + info . decorationsWidth + this . widget . indentationWidth ) ) ;
770
+ const width = Math . min ( maxWidth , info . contentWidth - ( info . glyphMarginWidth + info . decorationsWidth ) ) ;
777
771
this . _dimension = new Dimension ( width , heightInPixel ) ;
772
+ this . widget . domNode . style . marginLeft = `${ spaceLeft } px` ;
773
+ this . widget . domNode . style . marginRight = `${ spaceRight } px` ;
778
774
this . widget . domNode . style . width = `${ width } px` ;
779
775
this . widget . layout ( this . _dimension ) ;
780
776
}
@@ -791,36 +787,10 @@ export class InteractiveEditorZoneWidget extends ZoneWidget {
791
787
super . _relayout ( this . _computeHeightInLines ( ) ) ;
792
788
}
793
789
794
- showWidget ( selectionRange : Range , position : Position | undefined ) : void {
795
- console . log ( 'selectionRange : ' , selectionRange ) ;
796
- console . log ( 'position : ' , position ) ;
797
-
798
- super . show ( position ?? selectionRange . getEndPosition ( ) , this . _computeHeightInLines ( ) ) ;
790
+ override show ( where : IPosition ) : void {
791
+ super . show ( where , this . _computeHeightInLines ( ) ) ;
799
792
this . widget . focus ( ) ;
800
793
this . _ctxVisible . set ( true ) ;
801
- this . _setMargins ( selectionRange ) ;
802
- }
803
-
804
- private _setMargins ( selectionRange : Range ) : void {
805
- const info = this . editor . getLayoutInfo ( ) ;
806
- const startLineNumber = selectionRange . getStartPosition ( ) . lineNumber ;
807
- const endLineNumber = selectionRange . getEndPosition ( ) . lineNumber ;
808
- const viewModel = this . editor . _getViewModel ( ) ;
809
- let indentationLineNumber = endLineNumber ;
810
- let indentationLevel = viewModel ?. getLineFirstNonWhitespaceColumn ( endLineNumber ) ;
811
- for ( let lineNumber = endLineNumber ; lineNumber >= startLineNumber ; lineNumber -- ) {
812
- const currentIndentationLevel = viewModel ?. getLineFirstNonWhitespaceColumn ( lineNumber ) ;
813
- if ( currentIndentationLevel && currentIndentationLevel !== 0 ) {
814
- indentationLineNumber = lineNumber ;
815
- indentationLevel = currentIndentationLevel ;
816
- break ;
817
- }
818
- }
819
- this . widget . indentationWidth = ( indentationLevel ? this . editor . getOffsetForColumn ( indentationLineNumber , indentationLevel ) : 0 ) ;
820
- const spaceLeft = info . lineNumbersWidth + info . glyphMarginWidth + info . decorationsWidth + this . widget . indentationWidth ;
821
- const spaceRight = info . minimap . minimapWidth + info . verticalScrollbarWidth ;
822
- this . widget . domNode . style . marginLeft = `${ spaceLeft } px` ;
823
- this . widget . domNode . style . marginRight = `${ spaceRight } px` ;
824
794
}
825
795
826
796
override hide ( ) : void {
0 commit comments