@@ -119,7 +119,7 @@ export class InlineCompletionsModel extends Disposable {
119119 } ) ) ;
120120
121121 this . _register ( autorun ( reader => {
122- const jumpToReset = this . state . map ( s => ! s || s . kind === 'inlineEdit' && ! s . cursorAtInlineEdit ) . read ( reader ) ;
122+ const jumpToReset = this . state . map ( ( s , reader ) => ! s || s . kind === 'inlineEdit' && ! s . cursorAtInlineEdit . read ( reader ) ) . read ( reader ) ;
123123 if ( jumpToReset ) {
124124 this . _jumpedToId . set ( undefined , undefined ) ;
125125 }
@@ -428,7 +428,7 @@ export class InlineCompletionsModel extends Disposable {
428428 edits : readonly SingleTextEdit [ ] ;
429429 inlineEdit : InlineEdit ;
430430 inlineCompletion : InlineCompletionWithUpdatedRange ;
431- cursorAtInlineEdit : boolean ;
431+ cursorAtInlineEdit : IObservable < boolean > ;
432432 } | undefined > ( {
433433 owner : this ,
434434 equalsFn : ( a , b ) => {
@@ -439,7 +439,7 @@ export class InlineCompletionsModel extends Disposable {
439439 && a . inlineCompletion === b . inlineCompletion
440440 && a . suggestItem === b . suggestItem ;
441441 } else if ( a . kind === 'inlineEdit' && b . kind === 'inlineEdit' ) {
442- return a . inlineEdit . equals ( b . inlineEdit ) && a . cursorAtInlineEdit === b . cursorAtInlineEdit ;
442+ return a . inlineEdit . equals ( b . inlineEdit ) ;
443443 }
444444 return false ;
445445 }
@@ -455,13 +455,7 @@ export class InlineCompletionsModel extends Disposable {
455455 let edit = inlineEditResult . toSingleTextEdit ( reader ) ;
456456 edit = singleTextRemoveCommonPrefix ( edit , model ) ;
457457
458- const cursorPos = this . primaryPosition . read ( reader ) ;
459- const cursorAtInlineEdit = LineRange . fromRangeInclusive ( edit . range ) . addMargin ( 1 , 1 ) . contains ( cursorPos . lineNumber ) ;
460- const cursorInsideShowRange = cursorAtInlineEdit || ( inlineEditResult . inlineCompletion . cursorShowRange ?. containsPosition ( cursorPos ) ?? true ) ;
461-
462- if ( ! cursorInsideShowRange && ! this . _inAcceptFlow . read ( reader ) ) {
463- return undefined ;
464- }
458+ const cursorAtInlineEdit = this . primaryPosition . map ( cursorPos => LineRange . fromRangeInclusive ( edit . range ) . addMargin ( 1 , 1 ) . contains ( cursorPos . lineNumber ) ) ;
465459
466460 const commands = inlineEditResult . inlineCompletion . source . inlineCompletions . commands ;
467461 const inlineEdit = new InlineEdit ( edit , commands ?? [ ] , inlineEditResult . inlineCompletion ) ;
@@ -632,7 +626,7 @@ export class InlineCompletionsModel extends Disposable {
632626 return true ;
633627 }
634628
635- return ! s . cursorAtInlineEdit ;
629+ return ! s . cursorAtInlineEdit . read ( reader ) ;
636630 } ) ;
637631
638632 public readonly tabShouldAcceptInlineEdit = derived ( this , reader => {
@@ -653,7 +647,7 @@ export class InlineCompletionsModel extends Disposable {
653647 return false ;
654648 }
655649
656- return s . cursorAtInlineEdit ;
650+ return s . cursorAtInlineEdit . read ( reader ) ;
657651 } ) ;
658652
659653 private async _deltaSelectedInlineCompletionIndex ( delta : 1 | - 1 ) : Promise < void > {
0 commit comments