Skip to content

Commit 0650ff4

Browse files
authored
docs(amazonq): countTotalNumberOfCodeBlocks aws#5721
1 parent 37b6592 commit 0650ff4

File tree

1 file changed

+11
-2
lines changed
  • packages/core/src/codewhispererChat/controllers/chat/messenger

1 file changed

+11
-2
lines changed

packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,22 @@ export class Messenger {
9191
)
9292
)
9393
}
94-
94+
/**
95+
* Tries to calculate the total number of code blocks.
96+
* NOTES:
97+
* - Not correct on all examples. Some may cause it to return 0 unexpectedly.
98+
* - Plans in place (as of 4/22/2024) to move this server side.
99+
* - See original pr: https://github.com/aws/aws-toolkit-vscode/pull/4761 for more details.
100+
* @param message raw message response from codewhisperer client.
101+
* @returns count of multi-line code blocks in response.
102+
*/
95103
public async countTotalNumberOfCodeBlocks(message: string): Promise<number> {
104+
//TODO: remove this when moved to server-side.
96105
if (message === undefined) {
97106
return 0
98107
}
99108

100-
// // To Convert Markdown text to HTML using marked library
109+
// To Convert Markdown text to HTML using marked library
101110
const html = await marked(message)
102111

103112
const dom = new JSDOM(html)

0 commit comments

Comments
 (0)