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]

Fix --view_range for str_replace_editor

Kilian Lieretb91e79724f36
diff --git a/tools/edit_anthropic/bin/str_replace_editor b/tools/edit_anthropic/bin/str_replace_editor
index 3cd12d2a..c5984b93 100644
--- a/tools/edit_anthropic/bin/str_replace_editor
+++ b/tools/edit_anthropic/bin/str_replace_editor
@@ -338,7 +338,7 @@ def main():
parser.add_argument("command", type=str)
parser.add_argument("path", type=str)
parser.add_argument("--file_text", type=str)
- parser.add_argument("--view_range", type=str)
+ parser.add_argument("--view_range", type=int, nargs=2)
parser.add_argument("--old_str", type=str)
parser.add_argument("--new_str", type=str)
parser.add_argument("--insert_line", type=int)
diff --git a/tools/edit_anthropic/config.yaml b/tools/edit_anthropic/config.yaml
index 5a3dd6cd..19058ed5 100644
--- a/tools/edit_anthropic/config.yaml
+++ b/tools/edit_anthropic/config.yaml
@@ -34,7 +34,12 @@ tools:
type: array
items:
type: integer
- description: "Range of lines to display when evoking `view`. If not provided, the entire file is displayed."
+ description: >
+ Optional parameter of `view` command.
+ If none is given, the full file is shown.
+ If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12.
+ Indexing at 1 to start.
+ Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.
required: false
argument_format: "--view_range {value}"
- name: old_str