refactor to use io.write_text

This commit is contained in:
Paul Gauthier 2023-07-05 21:18:19 -07:00
parent 0ea52b412f
commit b46dffbb20
5 changed files with 16 additions and 15 deletions

View file

@ -136,7 +136,10 @@ class EditBlockFunctionCoder(Coder):
if not full_path:
continue
content = self.io.read_text(full_path)
if do_replace(full_path, content, original, updated, self.dry_run):
content = do_replace(full_path, content, original, updated)
if content:
if not self.dry_run:
self.io.write_text(full_path, content)
edited.add(path)
continue
self.io.tool_error(f"Failed to apply edit to {path}")