Skip to content

Commit 759854d

Browse files
committed
formatting the plan summary
1 parent 8c9e332 commit 759854d

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -370,21 +370,21 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin
370370
if (previousIterationContext == null) {
371371
// show another card as the answer
372372
val jobSummary = testGenerationResponse?.testGenerationJob()?.jobSummary()?.trim() ?: ""
373-
val cleanedJobSummary = jobSummary
373+
374+
val cleanedPlanSummary = jobSummary
375+
.replace(Regex("^```\\s*"), "") // Remove leading triple backticks
376+
.replace(Regex("\\s*```$"), "") // Remove trailing triple backticks
374377
.trim()
375-
.replace("```", "")
376-
.replace("`", "")
377-
.replace("\n", " ")
378-
println(jobSummary)
378+
379+
val fullMessage = """
380+
$cleanedPlanSummary
381+
382+
Please see the unit tests generated below. Click 'View Diff' to review the changes in the code editor.
383+
""".trimIndent() // Ensures no extra indentation for the entire message
384+
379385
val viewDiffMessageId = codeTestChatHelper.addAnswer(
380386
CodeTestChatMessageContent(
381-
message = """
382-
**Job Summary:**
383-
384-
$cleanedJobSummary
385-
386-
Please see the unit tests generated below. Click "View Diff" to review the changes in the code editor.
387-
""".trimIndent(),
387+
message = fullMessage,
388388
type = ChatMessageType.Answer,
389389
buttons = listOf(Button("utg_view_diff", "View Diff", keepCardAfterClick = true, position = "outside", status = "info")),
390390
fileList = listOf(getTestFilePathRelativeToRoot(targetFileInfo)),
@@ -393,6 +393,7 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin
393393
codeReference = codeReference
394394
)
395395
)
396+
396397
session.viewDiffMessageId = viewDiffMessageId
397398
codeTestChatHelper.updateUI(
398399
promptInputDisabledState = false,

0 commit comments

Comments
 (0)