From 587ba4d6761682399add0de31f3f9095cc0474bb Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 11 May 2024 10:38:44 -0700 Subject: [PATCH] Added functionality to suggest similar lines when a search block fails to match in EditBlockCoder. --- aider/coders/editblock_coder.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aider/coders/editblock_coder.py b/aider/coders/editblock_coder.py index 4a5c75ede..67d217d98 100644 --- a/aider/coders/editblock_coder.py +++ b/aider/coders/editblock_coder.py @@ -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