Skip to content

Commit e29c7f9

Browse files
committed
Addressing comments
1 parent edf643a commit e29c7f9

File tree

1 file changed

+5
-1
lines changed
  • plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/chat/messenger

1 file changed

+5
-1
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/chat/messenger/ChatPromptHandler.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ class ChatPromptHandler(private val telemetryHelper: TelemetryHelper) {
3232
private var requestId: String = ""
3333
private var statusCode: Int = 0
3434

35+
companion object {
36+
val CODE_BLOCK_REGEX: Regex = Regex("^```", RegexOption.MULTILINE)
37+
}
38+
3539
private fun countTotalNumberOfCodeBlocks(message: StringBuilder): Int {
3640
if (message.isEmpty()) {
3741
return 0
3842
}
39-
val countOfCodeBlocks = Regex("^```", RegexOption.MULTILINE).findAll(message)
43+
val countOfCodeBlocks = CODE_BLOCK_REGEX.findAll(message)
4044
val numberOfTripleBackTicksInMarkdown = countOfCodeBlocks.count()
4145
return numberOfTripleBackTicksInMarkdown / 2
4246
}

0 commit comments

Comments
 (0)