@@ -43,7 +43,7 @@ export abstract class EditModeStrategy {
43
43
44
44
abstract hasFocus ( ) : boolean ;
45
45
46
- abstract getWidgetPosition ( ) : Position | null ;
46
+ abstract getWidgetPosition ( ) : Position | undefined ;
47
47
}
48
48
49
49
export class PreviewStrategy extends EditModeStrategy {
@@ -131,8 +131,8 @@ export class PreviewStrategy extends EditModeStrategy {
131
131
// nothing to do
132
132
}
133
133
134
- getWidgetPosition ( ) : Position | null {
135
- return null ;
134
+ getWidgetPosition ( ) : Position | undefined {
135
+ return ;
136
136
}
137
137
138
138
hasFocus ( ) : boolean {
@@ -331,7 +331,7 @@ export class LiveStrategy extends EditModeStrategy {
331
331
this . _widget . updateStatus ( message ) ;
332
332
}
333
333
334
- private _lastLineOfLocalEdits ( ) : number | undefined {
334
+ override getWidgetPosition ( ) : Position | undefined {
335
335
const lastTextModelChanges = this . _session . lastTextModelChanges ;
336
336
let lastLineOfLocalEdits : number | undefined ;
337
337
for ( const change of lastTextModelChanges ) {
@@ -340,16 +340,7 @@ export class LiveStrategy extends EditModeStrategy {
340
340
lastLineOfLocalEdits = changeEndLineNumber ;
341
341
}
342
342
}
343
- return lastLineOfLocalEdits ;
344
- }
345
-
346
- override getWidgetPosition ( ) : Position | null {
347
- const isEditResponse = this . _session . lastExchange ?. response instanceof EditResponse ;
348
- if ( isEditResponse ) {
349
- const lastLineOfLocalEdits = this . _lastLineOfLocalEdits ( ) ;
350
- return lastLineOfLocalEdits ? new Position ( lastLineOfLocalEdits , 1 ) : null ;
351
- }
352
- return null ;
343
+ return lastLineOfLocalEdits ? new Position ( lastLineOfLocalEdits , 1 ) : undefined ;
353
344
}
354
345
355
346
hasFocus ( ) : boolean {
@@ -410,14 +401,6 @@ export class LivePreviewStrategy extends LiveStrategy {
410
401
scrollState . restore ( this . _editor ) ;
411
402
}
412
403
413
- override getWidgetPosition ( ) : Position | null {
414
- const isEditResponse = this . _session . lastExchange ?. response instanceof EditResponse ;
415
- if ( isEditResponse ) {
416
- return this . _session . wholeRange . value . getEndPosition ( ) ;
417
- }
418
- return null ;
419
- }
420
-
421
404
override hasFocus ( ) : boolean {
422
405
return super . hasFocus ( ) || this . _diffZone . hasFocus ( ) || this . _previewZone . hasFocus ( ) ;
423
406
}
0 commit comments