From 636f290627fcb117e39aa5f945e605c506cd98fc Mon Sep 17 00:00:00 2001 From: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> Date: Mon, 10 Feb 2025 18:30:35 -0800 Subject: [PATCH 1/2] Show the source file path instead of test file path in short answer if user does /test on test file. --- .../services/amazonqCodeTest/CodeWhispererUTGChatManager.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt index 9682e35da0c..511b4f3c9c7 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt @@ -59,6 +59,7 @@ import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.io.File import java.io.IOException +import java.nio.file.Path import java.nio.file.Paths import java.time.Duration import java.time.Instant @@ -249,9 +250,10 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin if (shortAnswer.stopIteration == "true") { throw CodeTestException("TestGenFailedError: ${shortAnswer.planSummary}", "TestGenFailedError", shortAnswer.planSummary) } + val fileName = shortAnswer.sourceFilePath?.let { Path.of(it).fileName.toString() } ?: path.fileName.toString() codeTestChatHelper.updateAnswer( CodeTestChatMessageContent( - message = generateSummaryMessage(path.fileName.toString()) + shortAnswer.planSummary, + message = generateSummaryMessage(fileName) + shortAnswer.planSummary, type = ChatMessageType.Answer ), messageIdOverride = codeTestResponseContext.testSummaryMessageId From ecdf671d4252fa7c780a4e1390f913654e969c76 Mon Sep 17 00:00:00 2001 From: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com> Date: Mon, 10 Feb 2025 18:34:18 -0800 Subject: [PATCH 2/2] Adding change log --- .../bugfix-62042604-3335-445b-90f6-d6f688087c9d.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .changes/next-release/bugfix-62042604-3335-445b-90f6-d6f688087c9d.json diff --git a/.changes/next-release/bugfix-62042604-3335-445b-90f6-d6f688087c9d.json b/.changes/next-release/bugfix-62042604-3335-445b-90f6-d6f688087c9d.json new file mode 100644 index 00000000000..658934d00cd --- /dev/null +++ b/.changes/next-release/bugfix-62042604-3335-445b-90f6-d6f688087c9d.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Amazon Q /test: Q identify active test file and infer source file for test generation." +} \ No newline at end of file