@@ -236,12 +236,12 @@ export class InlineChatController implements IEditorContribution {
236
236
237
237
// ---- state machine
238
238
239
- private _showWidget ( initialRender : boolean = false , position ?: IPosition ) {
239
+ private _showWidget ( initialRender : boolean = false , position ?: Position ) {
240
240
assertType ( this . _editor . hasModel ( ) ) ;
241
241
242
242
let widgetPosition = position
243
- ? Position . lift ( position )
244
- : this . _zone . value . position ?? this . _editor . getSelection ( ) . getStartPosition ( ) . delta ( - 1 ) ;
243
+ ?? this . _zone . value . position
244
+ ?? this . _editor . getSelection ( ) . getStartPosition ( ) . delta ( - 1 ) ;
245
245
246
246
let needsMargin = false ;
247
247
if ( initialRender ) {
@@ -275,7 +275,15 @@ export class InlineChatController implements IEditorContribution {
275
275
276
276
let session : Session | undefined = options . existingSession ;
277
277
278
- this . _showWidget ( true , options . position ) ;
278
+
279
+ let initPosition : Position | undefined ;
280
+ if ( options . position ) {
281
+ initPosition = Position . lift ( options . position ) . delta ( - 1 ) ;
282
+ delete options . position ;
283
+ }
284
+
285
+ this . _showWidget ( true , initPosition ) ;
286
+
279
287
this . _zone . value . widget . updateInfo ( localize ( 'welcome.1' , "AI-generated code may be incorrect" ) ) ;
280
288
this . _updatePlaceholder ( ) ;
281
289
@@ -366,7 +374,7 @@ export class InlineChatController implements IEditorContribution {
366
374
this . _zone . value . widget . selectAll ( ) ;
367
375
}
368
376
369
- this . _showWidget ( true , options . position ) ;
377
+ this . _showWidget ( true ) ;
370
378
371
379
this . _sessionStore . add ( this . _editor . onDidChangeModel ( ( e ) => {
372
380
const msg = this . _activeSession ?. lastExchange
0 commit comments