mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-12 10:55:17 +00:00
docs: add inline comments explaining diff marker normalization logic
This commit is contained in:
parent
1a4df62f89
commit
725a26ba88
1 changed files with 5 additions and 1 deletions
|
|
@ -877,14 +877,18 @@ def try_fix_yaml(response_text: str,
|
||||||
response_text_lines_copy[i] = ' ' + line[1:]
|
response_text_lines_copy[i] = ' ' + line[1:]
|
||||||
modified = True
|
modified = True
|
||||||
|
|
||||||
|
# normalize lines starting with '-'. Distinguish real YAML list items from diff deletions.
|
||||||
for i, line in enumerate(response_text_lines_copy):
|
for i, line in enumerate(response_text_lines_copy):
|
||||||
if not line.startswith('-'):
|
if not line.startswith('-'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
remainder = line[1:]
|
remainder = line[1:]
|
||||||
if line.startswith('- '):
|
if line.startswith('- '):
|
||||||
second_char = remainder[1] if len(remainder) > 1 else ''
|
second_char = remainder[1] if len(remainder) > 1 else ''
|
||||||
if second_char and second_char not in (' ', '\t', '+', '-'):
|
if second_char and second_char not in (' ', '\t', '+', '-'):
|
||||||
continue
|
continue # real list item → keep as-is
|
||||||
|
|
||||||
|
# treat it as a diff "removed" marker inside block content
|
||||||
cleaned = remainder
|
cleaned = remainder
|
||||||
while cleaned and cleaned[0] in ('+', '-'):
|
while cleaned and cleaned[0] in ('+', '-'):
|
||||||
cleaned = cleaned[1:]
|
cleaned = cleaned[1:]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue