File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
packages/amazonq/src/app/inline Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
1717 window ,
1818 TextEditor ,
1919 InlineCompletionTriggerKind ,
20+ Range ,
2021} from 'vscode'
2122import { LanguageClient } from 'vscode-languageclient'
2223import {
@@ -228,10 +229,13 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
228229 // get active item from session for displaying
229230 const items = this . sessionManager . getActiveRecommendation ( )
230231 const session = this . sessionManager . getActiveSession ( )
231- if ( ! session || ! items . length ) {
232+ const editor = window . activeTextEditor
233+ if ( ! session || ! items . length || ! editor ) {
232234 return [ ]
233235 }
234- const editor = window . activeTextEditor
236+
237+ const start = document . validatePosition ( editor . selection . active )
238+ const end = position
235239 for ( const item of items ) {
236240 item . command = {
237241 command : 'aws.amazonq.acceptInline' ,
@@ -245,6 +249,7 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
245249 session . firstCompletionDisplayLatency ,
246250 ] ,
247251 }
252+ item . range = new Range ( start , end )
248253 ReferenceInlineProvider . instance . setInlineReference (
249254 position . line ,
250255 item . insertText as string ,
You can’t perform that action at this time.
0 commit comments