Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions packages/amazonq/src/app/inline/recommendationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,23 @@ export class RecommendationService {
)

const isInlineEdit = result.items.some((item) => item.isInlineEdit)
if (!isInlineEdit) {
// If the suggestion is COMPLETIONS and there are more results to fetch, handle them in the background
getLogger().info(
'Suggestion type is COMPLETIONS. Start fetching for more items if partialResultToken exists.'
)
if (result.partialResultToken) {

if (result.partialResultToken) {
if (!isInlineEdit) {
// If the suggestion is COMPLETIONS and there are more results to fetch, handle them in the background
getLogger().info(
'Suggestion type is COMPLETIONS. Start fetching for more items if partialResultToken exists.'
)
this.processRemainingRequests(languageClient, request, result, token).catch((error) => {
languageClient.warn(`Error when getting suggestions: ${error}`)
})
} else {
// Skip fetching for more items if the suggesion is EDITS. If it is EDITS suggestion, only fetching for more
// suggestions when the user start to accept a suggesion.
// Save editsStreakPartialResultToken for the next EDITS suggestion trigger if user accepts.
getLogger().info('Suggestion type is EDITS. Skip fetching for more items.')
this.sessionManager.updateActiveEditsStreakToken(result.partialResultToken)
}
} else {
// Skip fetching for more items if the suggesion is EDITS. If it is EDITS suggestion, only fetching for more
// suggestions when the user start to accept a suggesion.
// Save editsStreakPartialResultToken for the next EDITS suggestion trigger if user accepts.
getLogger().info('Suggestion type is EDITS. Skip fetching for more items.')
this.sessionManager.updateActiveEditsStreakToken(result.partialResultToken)
}
} catch (error: any) {
getLogger().error('Error getting recommendations: %O', error)
Expand Down
4 changes: 2 additions & 2 deletions packages/amazonq/src/app/inline/sessionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export class SessionManager {
this._acceptedSuggestionCount += 1
}

public updateActiveEditsStreakToken(partialResultToken?: number | string) {
if (!this.activeSession || !partialResultToken) {
public updateActiveEditsStreakToken(partialResultToken: number | string) {
if (!this.activeSession) {
return
}
this.activeSession.editsStreakPartialResultToken = partialResultToken
Expand Down
Loading