@@ -9,7 +9,7 @@ import { assertType } from 'vs/base/common/types';
9
9
import { ICodeEditor } from 'vs/editor/browser/editorBrowser' ;
10
10
import { EditorLayoutInfo , EditorOption } from 'vs/editor/common/config/editorOptions' ;
11
11
import { Position } from 'vs/editor/common/core/position' ;
12
- import { IRange } from 'vs/editor/common/core/range' ;
12
+ import { IRange , Range } from 'vs/editor/common/core/range' ;
13
13
import { ZoneWidget } from 'vs/editor/contrib/zoneWidget/browser/zoneWidget' ;
14
14
import { localize } from 'vs/nls' ;
15
15
import { IContextKey , IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
@@ -18,6 +18,8 @@ import { ACTION_ACCEPT_CHANGES, ACTION_REGENERATE_RESPONSE, ACTION_TOGGLE_DIFF,
18
18
import { EditorBasedInlineChatWidget } from './inlineChatWidget' ;
19
19
import { MenuId } from 'vs/platform/actions/common/actions' ;
20
20
import { isEqual } from 'vs/base/common/resources' ;
21
+ import { StableEditorBottomScrollState } from 'vs/editor/browser/stableEditorScroll' ;
22
+ import { ScrollType } from 'vs/editor/common/editorCommon' ;
21
23
22
24
23
25
export class InlineChatZoneWidget extends ZoneWidget {
@@ -128,13 +130,17 @@ export class InlineChatZoneWidget extends ZoneWidget {
128
130
override show ( position : Position ) : void {
129
131
assertType ( this . container ) ;
130
132
133
+ const scrollState = StableEditorBottomScrollState . capture ( this . editor ) ;
131
134
const info = this . editor . getLayoutInfo ( ) ;
132
135
const marginWithoutIndentation = info . glyphMarginWidth + info . decorationsWidth + info . lineNumbersWidth ;
133
136
this . container . style . marginLeft = `${ marginWithoutIndentation } px` ;
134
137
135
138
super . show ( position , this . _computeHeightInLines ( ) ) ;
136
139
this . _setWidgetMargins ( position ) ;
137
140
this . widget . focus ( ) ;
141
+
142
+ scrollState . restore ( this . editor ) ;
143
+ this . editor . revealRangeNearTopIfOutsideViewport ( Range . fromPositions ( position . delta ( - 1 ) ) , ScrollType . Immediate ) ;
138
144
}
139
145
140
146
override updatePositionAndHeight ( position : Position ) : void {
0 commit comments