@@ -239,30 +239,41 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
239239 const editor = window . activeTextEditor
240240 if ( prevSession && prevSessionId && prevItemId && prevStartPosition ) {
241241 const prefix = document . getText ( new Range ( prevStartPosition , position ) )
242- const prevItemMatchingPrefix = [ ]
242+ const prevItemMatchingPrefix : InlineCompletionItemWithReferences [ ] = [ ]
243243 for ( const item of this . sessionManager . getActiveRecommendation ( ) ) {
244244 const text = typeof item . insertText === 'string' ? item . insertText : item . insertText . value
245- if ( text . startsWith ( prefix ) && position . isAfterOrEqual ( prevStartPosition ) ) {
246- item . command = {
247- command : 'aws.amazonq.acceptInline' ,
248- title : 'On acceptance' ,
249- arguments : [
250- prevSessionId ,
251- item ,
252- editor ,
253- prevSession ?. requestStartTime ,
254- position . line ,
255- prevSession ?. firstCompletionDisplayLatency ,
256- ] ,
245+ if ( prefix . length > 0 && text . startsWith ( prefix ) && position . isAfterOrEqual ( prevStartPosition ) ) {
246+ if ( item . isInlineEdit ) {
247+ prevItemMatchingPrefix . push ( item )
248+ } else {
249+ item . command = {
250+ command : 'aws.amazonq.acceptInline' ,
251+ title : 'On acceptance' ,
252+ arguments : [
253+ prevSessionId ,
254+ item ,
255+ editor ,
256+ prevSession ?. requestStartTime ,
257+ position . line ,
258+ prevSession ?. firstCompletionDisplayLatency ,
259+ ] ,
260+ }
261+ item . range = new Range ( prevStartPosition , position )
262+ prevItemMatchingPrefix . push ( item )
257263 }
258- item . range = new Range ( prevStartPosition , position )
259- prevItemMatchingPrefix . push ( item as InlineCompletionItem )
260264 }
261265 }
262266 // re-use previous suggestions as long as new typed prefix matches
263267 if ( prevItemMatchingPrefix . length > 0 ) {
268+ if ( prevItemMatchingPrefix [ 0 ] . isInlineEdit ) {
269+ // Check if Next Edit Prediction feature flag is enabled
270+ if ( Experiments . instance . isExperimentEnabled ( 'amazonqLSPNEP' ) ) {
271+ void showEdits ( prevItemMatchingPrefix [ 0 ] , editor , prevSession , this . languageClient ) . then ( )
272+ }
273+ return [ ]
274+ }
264275 getLogger ( ) . debug ( `Re-using suggestions that match user typed characters` )
265- return prevItemMatchingPrefix
276+ return prevItemMatchingPrefix as InlineCompletionItem [ ]
266277 }
267278 getLogger ( ) . debug ( `Auto rejecting suggestions from previous session` )
268279 // if no such suggestions, report the previous suggestion as Reject
0 commit comments