enlarge print_window

This commit is contained in:
黄伟韬 2024-09-13 19:39:56 +08:00
parent e4f9af904e
commit 72f2aaa02b
2 changed files with 5 additions and 6 deletions

View file

@ -84,7 +84,7 @@ class Editor(BaseModel):
resource: EditorReporter = EditorReporter()
current_file: Optional[Path] = None
current_line: int = 1
window: int = 100
window: int = 200
enable_auto_lint: bool = False
working_dir: Path = DEFAULT_WORKSPACE_ROOT
@ -633,8 +633,8 @@ class Editor(BaseModel):
)
error_info = ERROR_GUIDANCE.format(
linter_error_msg=LINTER_ERROR_MSG + str(e),
window_after_applied=self._print_window(file_name, start or len(lines), 40),
window_before_applied=self._print_window(Path(temp_backup_file.name), start or len(lines), 40),
window_after_applied=self._print_window(file_name, start or len(lines), 100),
window_before_applied=self._print_window(Path(temp_backup_file.name), start or len(lines), 100),
guidance_message=guidance_message,
).strip()
# Clean up the temporary file if an error occurs
@ -662,9 +662,7 @@ class Editor(BaseModel):
).strip()
return success_edit_info
def edit_file_by_replace(
self, file_name: str, start_line: Optional[int], end_line: Optional[int], new_content: str
) -> str:
def edit_file_by_replace(self, file_name: str, start_line: int, end_line: int, new_content: str) -> str:
"""
Line numbers start from 1. Replaces lines start_line through end_line (inclusive) with the given text in the open file.
All of the new_content will be entered, so makesure your indentation is formatted properly.

View file

@ -34,6 +34,7 @@ class Linter:
python=self.py_lint,
sql=self.fake_lint, # base_lint lacks support for full SQL syntax. Use fake_lint to bypass the validation.
css=self.fake_lint, # base_lint lacks support for css syntax. Use fake_lint to bypass the validation.
js=self.fake_lint, # base_lint lacks support for javascipt syntax. Use fake_lint to bypass the validation.
)
self.all_lint_cmd = None