Skip to content

Commit 5c113c8

Browse files
committed
fix bug
1 parent 1d4520f commit 5c113c8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,13 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
210210
}
211211

212212
// report suggestion state for previous suggestions if they exist
213-
const sessionId = this.sessionManager.getActiveSession()?.sessionId
214-
const itemId = this.sessionManager.getActiveRecommendation()?.[0]?.itemId
215-
if (sessionId && itemId) {
213+
const prevSessionId = this.sessionManager.getActiveSession()?.sessionId
214+
const prevItemId = this.sessionManager.getActiveRecommendation()?.[0]?.itemId
215+
if (prevSessionId && prevItemId) {
216216
const params: LogInlineCompletionSessionResultsParams = {
217-
sessionId: sessionId,
217+
sessionId: prevSessionId,
218218
completionSessionResult: {
219-
[itemId]: {
219+
[prevItemId]: {
220220
seen: true,
221221
accepted: false,
222222
discarded: false,
@@ -241,6 +241,7 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
241241
)
242242
// get active item from session for displaying
243243
const items = this.sessionManager.getActiveRecommendation()
244+
const itemId = this.sessionManager.getActiveRecommendation()?.[0]?.itemId
244245
const session = this.sessionManager.getActiveSession()
245246
const editor = window.activeTextEditor
246247

@@ -259,7 +260,7 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
259260
const cursorPosition = document.validatePosition(position)
260261

261262
if (position.isAfter(editor.selection.active)) {
262-
getLogger().debug(`Cursor moved behind trigger position. Discarding suggestion`)
263+
getLogger().debug(`Cursor moved behind trigger position. Discarding suggestion...`)
263264
const params: LogInlineCompletionSessionResultsParams = {
264265
sessionId: session.sessionId,
265266
completionSessionResult: {
@@ -304,7 +305,7 @@ export class AmazonQInlineCompletionItemProvider implements InlineCompletionItem
304305
// report discard if none of suggestions match typeahead
305306
if (itemsMatchingTypeahead.length === 0) {
306307
getLogger().debug(
307-
`Suggestion does not match user typed new characters during generation. Discarding suggestion`
308+
`Suggestion does not match user typeahead from insertion position. Discarding suggestion...`
308309
)
309310
const params: LogInlineCompletionSessionResultsParams = {
310311
sessionId: session.sessionId,

0 commit comments

Comments
 (0)