Skip to content

Commit 419e57b

Browse files
committed
add debugging info
1 parent 1f6269e commit 419e57b

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

packages/amazonq/test/e2e/inline/inline.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
toTextEditor,
1515
using,
1616
} from 'aws-core-vscode/test'
17-
import { RecommendationHandler, RecommendationService } from 'aws-core-vscode/codewhisperer'
17+
import { RecommendationHandler } from 'aws-core-vscode/codewhisperer'
1818
import { Commands, globals, sleep, waitUntil } from 'aws-core-vscode/shared'
1919
import { loginToIdC } from '../amazonq/utils/setup'
2020

@@ -41,7 +41,7 @@ describe('Amazon Q Inline', async function () {
4141
})
4242

4343
afterEach(async function () {
44-
if (this.currentTest?.state === 'failed') {
44+
if (this.currentTest === undefined || this.currentTest.isFailed()) {
4545
console.log('editor contents:\n %O', vscode.window.activeTextEditor?.document.getText())
4646
const suggestionStates = globals.telemetry.logger
4747
.query({
@@ -176,12 +176,12 @@ describe('Amazon Q Inline', async function () {
176176
await sleep(1000)
177177
await invokeCompletion()
178178

179-
if (name === 'automatic') {
180-
// It should never get triggered since its not a supported file type
181-
assert.deepStrictEqual(RecommendationService.instance.isRunning, false)
182-
} else {
183-
await getTestWindow().waitForMessage('currently not supported by Amazon Q inline suggestions')
184-
}
179+
// if (name === 'automatic') {
180+
// It should never get triggered since its not a supported file type
181+
// assert.deepStrictEqual(RecommendationService.instance.isRunning, false)
182+
// } else {
183+
await getTestWindow().waitForMessage('currently not supported by Amazon Q inline suggestions')
184+
// }
185185
})
186186
})
187187
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,8 @@ export class RecommendationHandler {
635635
}
636636

637637
async showRecommendation(indexShift: number, noSuggestionVisible: boolean = false) {
638+
// eslint-disable-next-line aws-toolkits/no-console-log
639+
console.log('showing recommendation')
638640
const session = CodeWhispererSessionState.instance.getSession()
639641

640642
if (!indexShift && session.recommendations.length) {
@@ -740,15 +742,28 @@ export class RecommendationHandler {
740742
}
741743

742744
async tryShowRecommendation() {
745+
// eslint-disable-next-line aws-toolkits/no-console-log
746+
console.log('trying to show recommendation')
743747
const session = CodeWhispererSessionState.instance.getSession()
744748
const editor = vscode.window.activeTextEditor
749+
// eslint-disable-next-line aws-toolkits/no-console-log
750+
console.log('editor is: %O', editor)
745751
if (editor === undefined) {
746752
return
747753
}
754+
// eslint-disable-next-line aws-toolkits/no-console-log
755+
console.log('isSuggestionVisible: %O', this.isSuggestionVisible())
748756
if (this.isSuggestionVisible()) {
749757
// do not force refresh the tooltip to avoid suggestion "flashing"
750758
return
751759
}
760+
761+
// eslint-disable-next-line aws-toolkits/no-console-log
762+
console.log('editor is: %O', editor)
763+
// eslint-disable-next-line aws-toolkits/no-console-log
764+
console.log(editor.selection.active.isBefore(session.startPos))
765+
// eslint-disable-next-line aws-toolkits/no-console-log
766+
console.log(editor.document.uri.fsPath !== this.documentUri?.fsPath)
752767
if (
753768
editor.selection.active.isBefore(session.startPos) ||
754769
editor.document.uri.fsPath !== this.documentUri?.fsPath

0 commit comments

Comments
 (0)