File tree Expand file tree Collapse file tree 1 file changed +16
-14
lines changed
packages/amazonq/src/app/inline Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -395,22 +395,24 @@ ${itemLog}
395395
396396 const cursorPosition = document . validatePosition ( position )
397397
398- // Edit suggestion works differently than completion suggestion, so even when it's a deletion and cause cursor to move back, we still allow the request to go through
399- if ( position . isAfter ( editor . selection . active ) && items . length > 0 && ! items [ 0 ] . isInlineEdit ) {
400- const params : LogInlineCompletionSessionResultsParams = {
401- sessionId : session . sessionId ,
402- completionSessionResult : {
403- [ itemId ] : {
404- seen : false ,
405- accepted : false ,
406- discarded : true ,
398+ // Completion will not be rendered if users cursor moves to a position which is before the position when the service is invoked
399+ if ( items . length > 0 && ! items [ 0 ] . isInlineEdit ) {
400+ if ( position . isAfter ( editor . selection . active ) ) {
401+ const params : LogInlineCompletionSessionResultsParams = {
402+ sessionId : session . sessionId ,
403+ completionSessionResult : {
404+ [ itemId ] : {
405+ seen : false ,
406+ accepted : false ,
407+ discarded : true ,
408+ } ,
407409 } ,
408- } ,
410+ }
411+ this . languageClient . sendNotification ( this . logSessionResultMessageName , params )
412+ this . sessionManager . clear ( )
413+ logstr += `- cursor moved behind trigger position. Discarding completion suggestion...`
414+ return [ ]
409415 }
410- this . languageClient . sendNotification ( this . logSessionResultMessageName , params )
411- this . sessionManager . clear ( )
412- logstr += `- cursor moved behind trigger position. Discarding completion suggestion...`
413- return [ ]
414416 }
415417
416418 // delay the suggestion rendeing if user is actively typing
You can’t perform that action at this time.
0 commit comments