@@ -195,9 +195,15 @@ export class InlineChatController implements IEditorContribution {
195
195
196
196
private _showWidget ( initialRender : boolean = false ) {
197
197
assertType ( this . _activeSession ) ;
198
- const selectionRange = this . _activeSession . wholeRange . value ;
199
- const widgetPosition = this . _strategy ?. getWidgetPosition ( initialRender , selectionRange ) ;
200
- this . _zone . value . show ( widgetPosition ?? selectionRange . getEndPosition ( ) ) ;
198
+ assertType ( this . _strategy ) ;
199
+
200
+ let widgetPosition : Position | null ;
201
+ if ( initialRender ) {
202
+ widgetPosition = this . _editor . getPosition ( ) ;
203
+ } else {
204
+ widgetPosition = this . _strategy . getWidgetPosition ( ) ;
205
+ }
206
+ this . _zone . value . show ( ( widgetPosition ?? this . _zone . value . position ) ?? this . _activeSession . wholeRange . value . getEndPosition ( ) ) ;
201
207
}
202
208
203
209
protected async _nextState ( state : State , options : InlineChatRunOptions | undefined ) : Promise < void > {
@@ -241,14 +247,14 @@ export class InlineChatController implements IEditorContribution {
241
247
242
248
switch ( session . editMode ) {
243
249
case EditMode . Live :
244
- this . _strategy = this . _instaService . createInstance ( LiveStrategy , this . _editor , session , this . _zone . value . widget ) ;
250
+ this . _strategy = this . _instaService . createInstance ( LiveStrategy , session , this . _editor , this . _zone . value . widget ) ;
245
251
break ;
246
252
case EditMode . Preview :
247
- this . _strategy = this . _instaService . createInstance ( PreviewStrategy , this . _editor , session , this . _zone . value . widget ) ;
253
+ this . _strategy = this . _instaService . createInstance ( PreviewStrategy , session , this . _zone . value . widget ) ;
248
254
break ;
249
255
case EditMode . LivePreview :
250
256
default :
251
- this . _strategy = this . _instaService . createInstance ( LivePreviewStrategy , this . _editor , session , this . _zone . value . widget ) ;
257
+ this . _strategy = this . _instaService . createInstance ( LivePreviewStrategy , session , this . _editor , this . _zone . value . widget ) ;
252
258
break ;
253
259
}
254
260
0 commit comments