Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Slight improvements to edit error messages

Kilian Lieretbc1a7e0fd5b4
diff --git a/tools/edit_replace/bin/edit b/tools/edit_replace/bin/edit
index 93c557d2..22443168 100644
--- a/tools/edit_replace/bin/edit
+++ b/tools/edit_replace/bin/edit
@@ -20,6 +20,7 @@ RETRY_WITH_OUTPUT_TOKEN = "###SWE-AGENT-RETRY-WITH-OUTPUT###"
_NOT_FOUND = """Your edit was not applied (file not modified): Text {search!r} not found in displayed lines (or anywhere in the file).
Please modify your search string. Did you forget to properly handle whitespace/indentation?
+You can also call `open` again to re-display the file with the correct context.
"""
_NOT_FOUND_IN_WINDOW_MSG = """Your edit was not applied (file not modified): Text {search!r} not found in displayed lines.
@@ -32,8 +33,7 @@ You can use the `goto` command to navigate to these locations before running the
"""
_MULTIPLE_OCCURRENCES_MSG = """Your edit was not applied (file not modified): Found more than one occurrence of {search!r} in the currently displayed lines.
-Please adapt your search string to only match _one_ occurrence.
-If you want to replace all occurrences, set replace_all=True, but please only use this if you really want to replace all occurrences in the file.
+Please make your search string more specific (for example, by including more lines of context).
"""
_NO_CHANGES_MADE_MSG = """Your search and replace strings are the same. No changes were made. Please modify your search or replace strings."""