-
Notifications
You must be signed in to change notification settings - Fork 751
fix(amazonq): unsupported languages test generation query #6363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
7959f38
d8535a2
6d07e61
3329e84
f0b1915
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "type": "Bug Fix", | ||
| "description": "Amazon Q: fix for test generation unsupported languages query" | ||
ashishrp-aws marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -246,6 +246,7 @@ export class TestController { | |
| TelemetryHelper.instance.sendTestGenerationToolkitEvent( | ||
| session, | ||
| true, | ||
| true, | ||
| isCancel ? 'Cancelled' : 'Failed', | ||
| session.startTestGenerationRequestId, | ||
| performance.now() - session.testGenerationStartTime, | ||
|
|
@@ -456,7 +457,14 @@ export class TestController { | |
| unsupportedMessage = `<span style="color: #EE9D28;">⚠<b>I'm sorry, but /test only supports Python and Java</b><br></span> I will still generate a suggestion below.` | ||
| } | ||
| this.messenger.sendMessage(unsupportedMessage, tabID, 'answer') | ||
| await this.onCodeGeneration(session, message.prompt, tabID, fileName, filePath) | ||
| await this.onCodeGeneration( | ||
| session, | ||
| message.prompt, | ||
| tabID, | ||
| fileName, | ||
| filePath, | ||
| workspaceFolder !== undefined | ||
| ) | ||
| } else { | ||
| this.messenger.sendCapabilityCard({ tabID }) | ||
| this.messenger.sendMessage(testGenSummaryMessage(fileName), message.tabID, 'answer-part') | ||
|
|
@@ -722,6 +730,7 @@ export class TestController { | |
| TelemetryHelper.instance.sendTestGenerationToolkitEvent( | ||
| session, | ||
| true, | ||
| true, | ||
| 'Succeeded', | ||
| session.startTestGenerationRequestId, | ||
| session.latencyOfTestGeneration, | ||
|
|
@@ -799,20 +808,21 @@ export class TestController { | |
| message: string, | ||
| tabID: string, | ||
| fileName: string, | ||
| filePath: string | ||
| filePath: string, | ||
| fileInWorkspace: boolean | ||
| ) { | ||
| try { | ||
| // TODO: Write this entire gen response to basiccommands and call here. | ||
| const editorText = await fs.readFileText(filePath) | ||
|
|
||
| const triggerPayload = { | ||
| query: `Generate unit tests for the following part of my code: ${message}`, | ||
| query: `Generate unit tests for the following part of my code: ${message?.trim() || fileName}`, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please describe how this fixes the issue in the PR description? (I'm assuming this is the fix) Before/after screenshots would be helpful as well, if possible
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
| codeSelection: undefined, | ||
| trigger: ChatTriggerType.ChatMessage, | ||
| fileText: editorText, | ||
| fileLanguage: session.fileLanguage, | ||
| filePath: filePath, | ||
| message: `Generate unit tests for the following part of my code: ${message}`, | ||
| message: `Generate unit tests for the following part of my code: ${message?.trim() || fileName}`, | ||
| matchPolicy: undefined, | ||
| codeQuery: undefined, | ||
| userIntent: UserIntent.GENERATE_UNIT_TESTS, | ||
|
|
@@ -827,7 +837,8 @@ export class TestController { | |
| tabID, | ||
| randomUUID.toString(), | ||
| triggerPayload, | ||
| fileName | ||
| fileName, | ||
| fileInWorkspace | ||
| ) | ||
| } finally { | ||
| this.messenger.sendChatInputEnabled(tabID, true) | ||
|
|
@@ -843,6 +854,7 @@ export class TestController { | |
| TelemetryHelper.instance.sendTestGenerationToolkitEvent( | ||
| session, | ||
| true, | ||
| true, | ||
| 'Succeeded', | ||
| session.startTestGenerationRequestId, | ||
| session.latencyOfTestGeneration, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.