mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
feat: add file change monitoring with gitignore support
This commit is contained in:
parent
da7bb312c2
commit
6a1754aa6a
1 changed files with 4 additions and 2 deletions
|
@ -366,10 +366,11 @@ class InputOutput:
|
|||
self.changed_files = None
|
||||
stop_event = threading.Event()
|
||||
|
||||
# Define the watcher thread function
|
||||
def watch_files():
|
||||
gitignore = Path(root) / ".gitignore"
|
||||
try:
|
||||
for changed in watch_source_files(root, stop_event=stop_event):
|
||||
dump(changed)
|
||||
if changed:
|
||||
self.changed_files = list(changed)[0] # Take the first changed file
|
||||
self.interrupt_input()
|
||||
|
@ -437,11 +438,12 @@ class InputOutput:
|
|||
)
|
||||
else:
|
||||
line = input(show)
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
except EOFError:
|
||||
# Check if we were interrupted by a file change
|
||||
if self.changed_files:
|
||||
changed = self.changed_files
|
||||
self.changed_files = None
|
||||
dump(changed)
|
||||
return f"/add {changed}" # Return an edit command for the changed file
|
||||
return ""
|
||||
except UnicodeEncodeError as err:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue