Skip to content

Commit 0c645d0

Browse files
committed
Expand diff parsing to recognize standard unified diff headers --- +++ alongside hunk headers @@
1 parent 271aad0 commit 0c645d0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • packages/vscode/src/commands/apply-chat-response-command/utils/clipboard-parser

‎packages/vscode/src/commands/apply-chat-response-command/utils/clipboard-parser/clipboard-parser.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ export const parse_response = (params: {
9090
const processed_response = params.response.replace(/``````/g, '```\n```')
9191

9292
const hunk_header_regex = /^(@@\s+-\d+(?:,\d+)?\s+\+\d+(?:,\d+)?\s+@@)/m
93-
const has_diff_lines_regex = /^[+-]/m
93+
const diff_header_regex = /^---\s+.+\n\+\+\+\s+.+/m
9494

9595
if (
96-
hunk_header_regex.test(processed_response) &&
97-
has_diff_lines_regex.test(processed_response)
96+
hunk_header_regex.test(processed_response) ||
97+
diff_header_regex.test(processed_response)
9898
) {
9999
const patches_or_text = extract_diffs({
100100
clipboard_text: processed_response,

0 commit comments

Comments
 (0)