Added functionality to suggest similar lines when a search block fails to match in EditBlockCoder.

This commit is contained in:
Paul Gauthier 2024-05-11 10:38:44 -07:00
parent 785259b59c
commit 587ba4d676

View file

@ -53,6 +53,12 @@ class EditBlockCoder(Coder):
res = f"# {len(failed)} SEARCH/REPLACE {blocks} failed to match!\n"
for edit in failed:
path, original, updated = edit
full_path = self.abs_root_path(path)
content = self.io.read_text(full_path)
did_you_mean = find_similar_lines(original, content)
res += f"""
## SearchReplaceNoExactMatch: This SEARCH block failed to exactly match lines in {path}
<<<<<<< SEARCH