From eea8e50c60af259962d320de2fa3e1606ea4fd19 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 11 May 2024 16:56:14 -0700 Subject: [PATCH] ask llm are you sure? when REPLACE exists --- aider/coders/editblock_coder.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/aider/coders/editblock_coder.py b/aider/coders/editblock_coder.py index 98e5c1656..8d710c196 100644 --- a/aider/coders/editblock_coder.py +++ b/aider/coders/editblock_coder.py @@ -60,10 +60,8 @@ class EditBlockCoder(Coder): res += f""" ## SearchReplaceNoExactMatch: This SEARCH block failed to exactly match lines in {path} <<<<<<< SEARCH -{original} -======= -{updated} ->>>>>>> REPLACE +{original}======= +{updated}>>>>>>> REPLACE """ did_you_mean = find_similar_lines(original, content) @@ -76,6 +74,11 @@ class EditBlockCoder(Coder): """ + if updated in content: + res += f"""Are you sure you need this SEARCH/REPLACE block? +The REPLACE lines are already in {path}! + +""" res += ( "The SEARCH section must exactly match an existing block of lines including all white" " space, comments, indentation, docstrings, etc\n"