Skip to content

Commit 69a17d2

Browse files
committed
Remove the requirement for preceding text to end with a colon when extracting content from a single code block
1 parent f3b2659 commit 69a17d2

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

‎packages/vscode/src/utils/cleanup-api-response/cleanup-api-response.ts‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@ export const cleanup_api_response = (params: { content: string }): string => {
2020
}
2121

2222
const code_block_count = (content.match(/```/g) || []).length
23-
if (code_block_count === 2) {
23+
if (code_block_count == 2) {
2424
const match = content.match(/```[^\n]*\n([\s\S]*?)\s*```/)
25-
if (match && typeof match[1] === 'string' && match.index !== undefined) {
26-
const before_text = content.substring(0, match.index).trim()
27-
if (before_text.endsWith(':')) {
28-
content = match[1]
29-
}
25+
if (match && typeof match[1] == 'string' && match.index !== undefined) {
26+
content = match[1]
3027
}
3128
}
3229

0 commit comments

Comments
 (0)