Skip to content

Commit ed81a55

Browse files
committed
fix(amazonq): completions not showing in function args
1 parent 6995107 commit ed81a55

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/amazonq/src/app/inline/completion.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
window,
1818
TextEditor,
1919
InlineCompletionTriggerKind,
20+
Range,
2021
} from 'vscode'
2122
import { LanguageClient } from 'vscode-languageclient'
2223
import {
@@ -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,

0 commit comments

Comments
 (0)