Skip to content

Commit d490ab1

Browse files
committed
Replace CDATA wrappers with markdown code blocks across prompt symbols and content parsers
- in 'add', prompt should be optional (saved as empty string) - should use code block instead cdata - simplify by removing 'nested wrappers' - simplify by removing support for 'cdata' ├── apps │ └── editor │ └── src │ ├── commands │ │ ├── apply-response-command │ │ │ └── utils │ │ │ ├── preview-handler.ts │ │ │ └── response-parser │ │ │ └── parsers │ │ │ └── diff-parser │ │ │ ├── diff-parser.ts │ │ │ ├── helpers │ │ │ │ ├── block-utils.ts │ │ │ │ ├── index.ts │ │ │ │ ├── patch-utils.ts │ │ │ │ └── path-utils.ts │ │ │ ├── index.ts │ │ │ └── test │ │ │ ├── cases │ │ │ │ ├── deletion-via-header │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── deletion-via-header.txt │ │ │ │ ├── deletion-via-redundant-header │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── deletion-via-redundant-header.txt │ │ │ │ ├── file-deletion │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── file-deletion.txt │ │ │ │ ├── git-and-hunk-header-same-line │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── git-and-hunk-header-same-line.txt │ │ │ │ ├── git-broken-hunk-header │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── git-broken-hunk-header.txt │ │ │ │ ├── git-two-header-types │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── git-two-header-types.txt │ │ │ │ ├── ignore-ellipsis │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── ignore-ellipsis.txt │ │ │ │ ├── in-non-diff-code-block │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── in-non-diff-code-block.txt │ │ │ │ ├── inner-backticks │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── inner-backticks.txt │ │ │ │ ├── inner-triple-backticks │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── inner-triple-backticks.txt │ │ │ │ ├── markdown-missing-ending │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── markdown-missing-ending.txt │ │ │ │ ├── markdown-path-above │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── markdown-path-above.txt │ │ │ │ ├── markdown-path-above-no-hunk-header │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── markdown-path-above-no-hunk-header.txt │ │ │ │ ├── markdown-path-above-with-text-containing-path │ │ │ │ │ ├── 1-text.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── markdown-path-above-with-text-containing-path.txt │ │ │ │ ├── markdown-redundant-closing-backticks │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── markdown-redundant-closing-backticks.txt │ │ │ │ ├── markdown-repeated-path-above │ │ │ │ │ ├── 1-text.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── markdown-repeated-path-above.txt │ │ │ │ ├── markdown-unnecessary-empty-lines │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── markdown-path-above.txt │ │ │ │ ├── mix-delete-and-new-file │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── mix-delete-and-new-file.txt │ │ │ │ ├── mix-new-file-and-diff │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── mix-new-file-and-diff.txt │ │ │ │ ├── mix-new-file-from-heading-and-diff │ │ │ │ │ ├── 1-text.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ ├── 3-file.txt │ │ │ │ │ └── mix-new-file-from-heading-and-diff.txt │ │ │ │ ├── mix-new-file-from-xml-tag-heading-and-diff │ │ │ │ │ ├── 1-text.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ ├── 3-file.txt │ │ │ │ │ └── mix-new-file-from-xml-tag-heading-and-diff.txt │ │ │ │ ├── mix-new-file-xml-and-diff-variant-1 │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── mix-new-file-xml-and-diff-variant-1.txt │ │ │ │ ├── mix-new-file-xml-and-diff-variant-2 │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── mix-new-file-xml-and-diff-variant-2.txt │ │ │ │ ├── mix-rename-and-update │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── mix-rename-and-update.txt │ │ │ │ ├── mix-rename-one-liner-and-diff │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── mix-rename-one-liner-and-diff.txt │ │ │ │ ├── multiple-edits-for-the-same-file │ │ │ │ │ ├── 1-text.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-edits-for-the-same-file.txt │ │ │ │ ├── multiple-files-git-and-hunk-header-same-line │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-files-git-and-hunk-header-same-line.txt │ │ │ │ ├── multiple-files-no-markdown-block │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-files-no-markdown-block.txt │ │ │ │ ├── multiple-files-no-prefix-single-markdown-block │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-files-no-prefix-single-markdown-block.txt │ │ │ │ ├── multiple-files-same-line-backticks │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-files-same-line-backticks.txt │ │ │ │ ├── multiple-files-separate-markdown-blocks │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-files-separate-markdown-blocks.txt │ │ │ │ ├── multiple-files-single-markdown-block │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-files-single-markdown-block.txt │ │ │ │ ├── multiple-files-text-between │ │ │ │ │ ├── 1-text.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ ├── 3-text.txt │ │ │ │ │ ├── 4-file.txt │ │ │ │ │ ├── 5-text.txt │ │ │ │ │ └── multiple-files-text-between.txt │ │ │ │ ├── multiple-files-with-git-headers-no-file-lines │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-files-with-git-headers-no-file-lines.txt │ │ │ │ ├── multiple-files-with-git-headers-separate-markdown-blocks │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-files-with-git-headers-separate-markdown-blocks.txt │ │ │ │ ├── multiple-files-with-quoted-paths │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-files-with-quoted-paths.txt │ │ │ │ ├── multiple-files-with-timestamps │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-files-with-timestamps.txt │ │ │ │ ├── multiple-new-files-separate-markdown-blocks │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ ├── 2-file.txt │ │ │ │ │ └── multiple-new-files-separate-markdown-blocks.txt │ │ │ │ ├── new-file-with-git-header │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── new-file-with-git-header.txt │ │ │ │ ├── no-markdown-or-git-header │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── no-markdown-or-git-header.txt │ │ │ │ ├── no-prefix │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── no-prefix.txt │ │ │ │ ├── non-diff-code-blocks │ │ │ │ │ ├── 1-text.txt │ │ │ │ │ ├── 2-inline-file.txt │ │ │ │ │ ├── 3-file.txt │ │ │ │ │ └── non-diff-code-blocks.txt │ │ │ │ ├── rename │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── rename.txt │ │ │ │ ├── with-empty-lines-between │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── with-empty-lines-between.txt │ │ │ │ ├── with-git-header-no-file-lines │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── with-git-header-no-file-lines.txt │ │ │ │ ├── with-git-header-no-markdown │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── with-git-header-no-markdown.txt │ │ │ │ ├── with-quoted-paths │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── with-quoted-paths.txt │ │ │ │ ├── with-timestamps │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── with-timestamps.txt │ │ │ │ ├── with-xml-file-path │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── with-xml-file-path.txt │ │ │ │ ├── within-xml-tags │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── within-xml-tags.txt │ │ │ │ ├── within-xml-tags-unquoted-path │ │ │ │ │ ├── 1-file.txt │ │ │ │ │ └── within-xml-tags-unquoted-path.txt │ │ │ │ └── within-xml-tags-with-cdata │ │ │ │ ├── 1-file.txt │ │ │ │ └── within-xml-tags-with-cdata.txt │ │ │ └── diff-parser.spec.ts │ │ ├── code-at-cursor-command │ │ │ ├── code-at-cursor-commands.ts │ │ │ └── utils │ │ │ └── perform-code-at-cursor.ts │ │ └── generate-commit-message-command │ │ └── actions │ │ └── run-generate-action.ts │ ├── features │ │ ├── checkpoints │ │ │ └── actions │ │ │ └── restore-checkpoint.ts │ │ └── search-files │ │ └── utils │ │ └── search-files-by-intelligent.ts │ ├── services │ │ └── git-discard-file-watcher.ts │ ├── utils │ │ ├── cleanup-api-response │ │ │ ├── cleanup-api-response.spec.ts │ │ │ ├── cleanup-api-response.ts │ │ │ ├── index.ts │ │ │ └── test-cases │ │ │ ├── extract-code-block-surrounded-by-text │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── extract-markdown-with-surrounding-text │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── keep-think-block-not-at-start │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── markdown-block │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── plain-text │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── remove-doctype │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── remove-file-tags │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── remove-files-tags │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── remove-markdown-wrapper │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── remove-markdown-wrapper-with-lang │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── remove-think-block-at-start │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── remove-think-block-with-newlines │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ ├── remove-thought-block-at-start │ │ │ │ ├── expected.txt │ │ │ │ └── input.txt │ │ │ └── trim-whitespace │ │ │ ├── expected.txt │ │ │ └── input.txt │ │ └── commit-message-details.ts │ └── views │ └── prompt │ └── backend │ └── utils │ └── symbols │ ├── fragment │ │ └── replace-fragment-symbol.ts │ ├── git │ │ └── replace-git-symbols.ts │ ├── pasted-text │ │ └── replace-pasted-text-symbol.ts │ ├── saved-context │ │ └── replace-saved-context-symbol.ts │ ├── skill │ │ └── replace-skill-symbol.ts │ └── website │ └── replace-website-symbol.ts └── packages ├── shared │ └── src │ └── utils │ └── simplify-prompt-symbols │ ├── simplify-prompt-symbols.spec.ts │ └── simplify-prompt-symbols.ts └── ui └── src └── components └── editor └── prompt ├── ResponsePreview │ └── ResponsePreview.tsx ├── Responses │ └── Responses.tsx └── prompts ├── PromptField │ └── hooks │ └── use-handlers │ └── handle-paste.ts └── shared └── symbols ├── get-highlighted-text.tsx ├── position-mapping.ts ├── reconstruct-raw-value.ts └── use-symbol-deletion.ts
1 parent 0895b39 commit d490ab1

28 files changed

Lines changed: 119 additions & 173 deletions

File tree

‎apps/editor/src/commands/apply-response-command/utils/preview-handler.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export const preview_handler = async (params: {
157157
CommitMessageDetails.add({
158158
extension_context: params.extension_context,
159159
workspace_root,
160-
prompt: params.raw_instructions || '',
160+
prompt: params.raw_instructions,
161161
files,
162162
selected_files: selected_files_by_workspace.get(workspace_root) || []
163163
})

‎apps/editor/src/commands/apply-response-command/utils/response-parser/parsers/diff-parser/diff-parser.ts‎

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -147,24 +147,7 @@ const convert_code_block_to_new_file_diff = (params: {
147147
file_tag_end != -1 &&
148148
file_tag_end > file_tag_start
149149
) {
150-
const inner_lines = params.lines.slice(file_tag_start + 1, file_tag_end)
151-
152-
const cdata_start = inner_lines.findIndex((l) =>
153-
l.trim().startsWith('<![CDATA[')
154-
)
155-
let cdata_end = -1
156-
for (let i = inner_lines.length - 1; i >= 0; i--) {
157-
if (inner_lines[i].trim().endsWith(']]>')) {
158-
cdata_end = i
159-
break
160-
}
161-
}
162-
163-
if (cdata_start != -1 && cdata_end != -1 && cdata_end > cdata_start) {
164-
content_lines = inner_lines.slice(cdata_start + 1, cdata_end)
165-
} else {
166-
content_lines = inner_lines
167-
}
150+
content_lines = params.lines.slice(file_tag_start + 1, file_tag_end)
168151
} else {
169152
content_lines = params.lines.slice(1)
170153
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<file path="src/index.ts">
2-
<![CDATA[
32
@@ -0,0 +1,1 @@
43
+console.log('hello')
5-
]]>
64
</file>

‎apps/editor/src/commands/apply-response-command/utils/response-parser/parsers/diff-parser/test/diff-parser.spec.ts‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -882,22 +882,6 @@ describe('diff-parser', () => {
882882
})
883883
})
884884

885-
it('parses diff within XML tags with CDATA', () => {
886-
const test_case = 'within-xml-tags-with-cdata'
887-
const text = load_test_case_file(test_case, `${test_case}.txt`)
888-
const result = parse_response({
889-
response: text,
890-
is_single_root_folder_workspace: true
891-
})
892-
893-
expect(result).toHaveLength(1)
894-
expect(result[0]).toMatchObject({
895-
type: 'diff',
896-
file_path: 'src/index.ts',
897-
content: load_test_case_file(test_case, '1-file.txt')
898-
})
899-
})
900-
901885
it('parses diff within XML tags with unquoted path', () => {
902886
const test_case = 'within-xml-tags-unquoted-path'
903887
const text = load_test_case_file(test_case, `${test_case}.txt`)

‎apps/editor/src/commands/code-at-cursor-command/code-at-cursor-commands.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const code_at_cursor_commands = (params: {
1616
'codeWebChat.internal.codeAtCursorAccepted',
1717
async (args: {
1818
workspace_root: string
19-
prompt: string
19+
prompt?: string
2020
file_path: string
2121
selected_files: string[]
2222
}) => {

‎apps/editor/src/commands/code-at-cursor-command/utils/perform-code-at-cursor.ts‎

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,34 @@ export const perform_code_at_cursor = async (params: {
215215
)
216216
if (match && match[1]) {
217217
let decoded_completion = he.decode(match[1].trim())
218-
decoded_completion = decoded_completion
219-
.replace(/<!\[CDATA\[/g, '')
220-
.replace(/\]\]>/g, '')
221-
.trim()
218+
219+
if (decoded_completion.startsWith('```')) {
220+
const first_newline = decoded_completion.indexOf('\n')
221+
if (first_newline !== -1) {
222+
decoded_completion = decoded_completion.substring(
223+
first_newline + 1
224+
)
225+
}
226+
}
227+
if (decoded_completion.endsWith('```')) {
228+
const last_newline = decoded_completion.lastIndexOf('\n')
229+
if (
230+
last_newline !== -1 &&
231+
last_newline > decoded_completion.indexOf('\n')
232+
) {
233+
decoded_completion = decoded_completion.substring(
234+
0,
235+
last_newline
236+
)
237+
} else {
238+
decoded_completion = decoded_completion.substring(
239+
0,
240+
decoded_completion.length - 3
241+
)
242+
}
243+
}
244+
245+
decoded_completion = decoded_completion.trim()
222246

223247
const active_file_path = editor.document.uri.fsPath
224248
const workspace_root =
@@ -253,9 +277,7 @@ export const perform_code_at_cursor = async (params: {
253277
arguments: [
254278
{
255279
workspace_root,
256-
prompt:
257-
completion_instructions ||
258-
'Code at cursor completion',
280+
prompt: completion_instructions,
259281
file_path: active_file_path,
260282
selected_files
261283
}

‎apps/editor/src/features/search-files/utils/search-files-by-intelligent.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const search_files_by_intelligent = async (
2222
let xml_files = `<files>\n`
2323
for (const file of files_data) {
2424
const content_to_use = shrink_result ? file.shrunk_content : file.content
25-
xml_files += `<file path="${file.display_path}">\n<![CDATA[\n${content_to_use}\n]]>\n</file>\n`
25+
xml_files += `<file path="${file.display_path}">\n\`\`\`\n${content_to_use}\n\`\`\`\n</file>\n`
2626
}
2727
xml_files += `</files>`
2828

‎apps/editor/src/utils/cleanup-api-response/cleanup-api-response.spec.ts‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,33 +72,13 @@ describe('cleanup_api_response', () => {
7272
expect(cleanup_api_response({ content })).toBe(expected)
7373
})
7474

75-
it('should remove CDATA wrappers', () => {
76-
const test_case = 'remove-cdata-wrapper'
77-
const content = load_test_case_file(test_case, 'input.txt')
78-
const expected = load_test_case_file(test_case, 'expected.txt')
79-
expect(cleanup_api_response({ content })).toBe(expected)
80-
})
81-
8275
it('should remove DOCTYPE declaration', () => {
8376
const test_case = 'remove-doctype'
8477
const content = load_test_case_file(test_case, 'input.txt')
8578
const expected = load_test_case_file(test_case, 'expected.txt')
8679
expect(cleanup_api_response({ content })).toBe(expected)
8780
})
8881

89-
it('should handle nested wrappers iteratively', () => {
90-
const test_case = 'nested-wrappers'
91-
const content = load_test_case_file(test_case, 'input.txt')
92-
const expected = load_test_case_file(test_case, 'expected.txt')
93-
expect(cleanup_api_response({ content })).toBe(expected)
94-
})
95-
96-
it('should handle content with only wrappers', () => {
97-
const test_case = 'only-wrappers'
98-
const content = load_test_case_file(test_case, 'input.txt')
99-
expect(cleanup_api_response({ content })).toBe('')
100-
})
101-
10282
it('should extract content from a code block surrounded by text', () => {
10383
const test_case = 'extract-code-block-surrounded-by-text'
10484
const content = load_test_case_file(test_case, 'input.txt')

‎apps/editor/src/utils/cleanup-api-response/cleanup-api-response.ts‎

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export const cleanup_api_response = (params: { content: string }): string => {
22
let content = params.content.trim()
3-
let changed = true
43

54
if (content.startsWith('<think>')) {
65
const end_index = content.indexOf('</think>')
@@ -30,45 +29,38 @@ export const cleanup_api_response = (params: { content: string }): string => {
3029
}
3130
}
3231

33-
while (changed) {
34-
const original_content = content
32+
const opening_patterns = [
33+
/^```[^\n]*\n/,
34+
/^<files[^>]*>\s*\n?/,
35+
/^<file[^>]*>\s*\n?/,
36+
/^<!DOCTYPE[^>]*>\s*\n?/
37+
]
3538

36-
const opening_patterns = [
37-
/^```[^\n]*\n/,
38-
/^<files[^>]*>\s*\n?/,
39-
/^<file[^>]*>\s*\n?/,
40-
/^<!\[CDATA\[\s*\n?/,
41-
/^<!DOCTYPE[^>]*>\s*\n?/
42-
]
43-
44-
for (const pattern of opening_patterns) {
45-
const match = content.match(pattern)
46-
if (match && match.index == 0) {
47-
content = content.substring(match[0].length)
48-
break
49-
}
39+
for (const pattern of opening_patterns) {
40+
const match = content.match(pattern)
41+
if (match && match.index == 0) {
42+
content = content.substring(match[0].length)
43+
break
5044
}
45+
}
5146

52-
const closing_patterns = [
53-
/\s*```\s*$/,
54-
/\s*<\/files>\s*$/,
55-
/\s*<\/file>\s*$/,
56-
/\s*\]\]>\s*$/
57-
]
47+
const closing_patterns = [
48+
/\s*```\s*$/,
49+
/\s*<\/files>\s*$/,
50+
/\s*<\/file>\s*$/,
51+
/\s*\]\]>\s*$/
52+
]
5853

59-
for (const pattern of closing_patterns) {
60-
const match = content.match(pattern)
61-
if (
62-
match &&
63-
match.index !== undefined &&
64-
match.index + match[0].length == content.length
65-
) {
66-
content = content.substring(0, match.index)
67-
break
68-
}
54+
for (const pattern of closing_patterns) {
55+
const match = content.match(pattern)
56+
if (
57+
match &&
58+
match.index !== undefined &&
59+
match.index + match[0].length == content.length
60+
) {
61+
content = content.substring(0, match.index)
62+
break
6963
}
70-
71-
changed = content != original_content
7264
}
7365

7466
content = content.trim()

‎apps/editor/src/utils/cleanup-api-response/test-cases/nested-wrappers/expected.txt‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)