mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
fix: handle updated edits array in apply_edits return value
This commit is contained in:
parent
eb9a73bdb0
commit
f9604633e6
2 changed files with 4 additions and 1 deletions
|
@ -1812,6 +1812,8 @@ class Coder:
|
|||
try:
|
||||
edits = self.get_edits()
|
||||
edits = self.prepare_to_edit(edits)
|
||||
|
||||
# ai: handle the case where apply_edits returns an updated edits array (it may just return None, meaning use the existing edits array)!
|
||||
edited = set(edit[0] for edit in edits)
|
||||
self.apply_edits(edits)
|
||||
except ValueError as err:
|
||||
|
|
|
@ -50,6 +50,7 @@ class EditBlockCoder(Coder):
|
|||
content = self.io.read_text(full_path)
|
||||
new_content = do_replace(full_path, content, original, updated, self.fence)
|
||||
if new_content:
|
||||
# ai: update the edits array to reflect the actually edited file
|
||||
break
|
||||
|
||||
if new_content:
|
||||
|
@ -59,7 +60,7 @@ class EditBlockCoder(Coder):
|
|||
failed.append(edit)
|
||||
|
||||
if not failed:
|
||||
return
|
||||
return # ai: return the updated list of edits
|
||||
|
||||
blocks = "block" if len(failed) == 1 else "blocks"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue