Skip to content

Commit 244e817

Browse files
committed
fix
1 parent b155f87 commit 244e817

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

packages/core/src/codewhisperer/commands/onInlineAcceptance.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,12 @@ export async function onInlineAcceptance(acceptanceEntry: OnRecommendationAccept
144144

145145
RecommendationHandler.instance.reportUserDecisions(acceptanceEntry.acceptIndex)
146146
if (acceptanceEntry.acceptIndex == 0) {
147-
// TODO: gate behind A/B group if needed
148147
const nextSession = CodeWhispererSessionState.instance.getNextSession()
149148
nextSession.startPos = acceptanceEntry.editor.selection.active
150149
CodeWhispererSessionState.instance.setSession(nextSession)
151-
await RecommendationHandler.instance.showNextRecommendations()
150+
if (nextSession.recommendations.length) {
151+
await RecommendationHandler.instance.tryShowRecommendation()
152+
}
152153
}
153154
}
154155
}

packages/core/src/codewhisperer/service/recommendationHandler.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ export class RecommendationHandler {
171171
pagination: boolean = true,
172172
page: number = 0,
173173
generate: boolean = isIamConnection(AuthUtil.instance.conn),
174-
// currentSession: any = this.session,
175174
isNextSession: boolean = false
176175
): Promise<GetRecommendationsResponse> {
177176
let invocationResult: 'Succeeded' | 'Failed' = 'Failed'
@@ -335,7 +334,6 @@ export class RecommendationHandler {
335334
reason = error ? String(error) : 'unknown'
336335
}
337336
} finally {
338-
console.log('final session', currentSession)
339337
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
340338

341339
let msg = indent(
@@ -399,7 +397,7 @@ export class RecommendationHandler {
399397
}
400398
}
401399

402-
if (this.isCancellationRequested()) {
400+
if (!isNextSession && this.isCancellationRequested()) {
403401
return Promise.resolve<GetRecommendationsResponse>({
404402
result: invocationResult,
405403
errorMessage: errorMessage,
@@ -456,7 +454,6 @@ export class RecommendationHandler {
456454
this.reportUserDecisions(-1)
457455
}
458456
}
459-
console.log('final session', currentSession)
460457
return Promise.resolve<GetRecommendationsResponse>({
461458
result: invocationResult,
462459
errorMessage: errorMessage,
@@ -720,11 +717,6 @@ export class RecommendationHandler {
720717
return this.inlineCompletionProvider?.getActiveItemIndex !== undefined
721718
}
722719

723-
async showNextRecommendations() {
724-
getLogger().info('show pre-loaded recommendation')
725-
await this.showRecommendation(0, false)
726-
}
727-
728720
async getConfigEntry(): Promise<ConfigurationEntry> {
729721
const codewhispererSettings = CodeWhispererSettings.instance
730722
const isShowMethodsEnabled: boolean =

0 commit comments

Comments
 (0)