File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
src/vs/workbench/contrib/inlineChat/browser Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -272,7 +272,22 @@ export class InteractiveEditorController implements IEditorContribution {
272
272
console . log ( 'initialRender : ' , initialRender ) ;
273
273
assertType ( this . _activeSession ) ;
274
274
const selectionRange = this . _activeSession . wholeRange . value ;
275
- this . _zone . value . showWidget ( selectionRange , this . _strategy ?. getWidgetPosition ( initialRender , selectionRange ) ) ;
275
+
276
+ if ( ! initialRender ) {
277
+ if ( this . _activeSession . lastPosition ) {
278
+ this . _zone . value . showWidget ( selectionRange , this . _activeSession . lastPosition ) ;
279
+ } else {
280
+ const widgetPosition = this . _strategy ?. getWidgetPosition ( initialRender , selectionRange ) ;
281
+ this . _activeSession . lastPosition = widgetPosition ;
282
+ this . _zone . value . showWidget ( selectionRange , widgetPosition ) ;
283
+ }
284
+ } else {
285
+ if ( this . _activeSession . lastPosition ) {
286
+ this . _zone . value . showWidget ( selectionRange , this . _activeSession . lastPosition ) ;
287
+ } else {
288
+ this . _zone . value . showWidget ( selectionRange , this . _strategy ?. getWidgetPosition ( initialRender , selectionRange ) ) ;
289
+ }
290
+ }
276
291
}
277
292
278
293
private async [ State . INIT_UI ] ( options : InteractiveEditorRunOptions | undefined ) : Promise < State . WAIT_FOR_INPUT | State . SHOW_RESPONSE | State . APPLY_RESPONSE > {
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
25
25
import { isCancellationError } from 'vs/base/common/errors' ;
26
26
import { LineRangeMapping } from 'vs/editor/common/diff/linesDiffComputer' ;
27
27
import { ISingleEditOperation } from 'vs/editor/common/core/editOperation' ;
28
+ import { Position } from 'vs/editor/common/core/position' ;
28
29
29
30
export type Recording = {
30
31
when : Date ;
@@ -112,6 +113,7 @@ export class Session {
112
113
private _lastExpansionState : ExpansionState | undefined ;
113
114
private _lastTextModelChanges : readonly LineRangeMapping [ ] | undefined ;
114
115
private _isUnstashed : boolean = false ;
116
+ private _lastPosition : Position | undefined ;
115
117
private readonly _exchange : SessionExchange [ ] = [ ] ;
116
118
private readonly _startTime = new Date ( ) ;
117
119
private readonly _teldata : Partial < TelemetryData > ;
@@ -155,6 +157,14 @@ export class Session {
155
157
return this . _lastInput ;
156
158
}
157
159
160
+ get lastPosition ( ) {
161
+ return this . _lastPosition ;
162
+ }
163
+
164
+ set lastPosition ( position : Position | undefined ) {
165
+ this . _lastPosition = position ;
166
+ }
167
+
158
168
get lastExpansionState ( ) : ExpansionState | undefined {
159
169
return this . _lastExpansionState ;
160
170
}
You can’t perform that action at this time.
0 commit comments