mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
feat: add input interruption on file changes in FileWatcher
This commit is contained in:
parent
ac7900ecd7
commit
496b92536f
1 changed files with 6 additions and 4 deletions
|
@ -9,7 +9,7 @@ from watchfiles import watch
|
|||
|
||||
from aider.dump import dump # noqa
|
||||
|
||||
VERBOSE = False
|
||||
VERBOSE = True
|
||||
|
||||
|
||||
def is_source_file(path: Path) -> bool:
|
||||
|
@ -65,10 +65,11 @@ def load_gitignores(gitignore_paths: list[Path]) -> Optional[PathSpec]:
|
|||
class FileWatcher:
|
||||
"""Watches source files for changes and AI comments"""
|
||||
|
||||
def __init__(self, directory: str, encoding="utf-8", gitignores: list[str] = None):
|
||||
self.directory = directory
|
||||
def __init__(self, coder, encoding="utf-8", gitignores=None):
|
||||
self.coder = coder
|
||||
self.directory = coder.root
|
||||
self.encoding = encoding
|
||||
self.root = Path(directory)
|
||||
self.root = Path(self.directory)
|
||||
self.root_abs = self.root.absolute()
|
||||
self.stop_event = None
|
||||
self.watcher_thread = None
|
||||
|
@ -139,6 +140,7 @@ class FileWatcher:
|
|||
dump(result)
|
||||
if result:
|
||||
self.changed_files = result
|
||||
self.io.interrupt_input()
|
||||
return
|
||||
except Exception as e:
|
||||
if VERBOSE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue