mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 02:34:59 +00:00
refactor: consolidate file watching code into dedicated class
This commit is contained in:
parent
f7a05cf077
commit
af195a610c
2 changed files with 4 additions and 2 deletions
|
@ -392,7 +392,7 @@ class InputOutput:
|
||||||
):
|
):
|
||||||
self.rule()
|
self.rule()
|
||||||
|
|
||||||
# Add a variable to store changed files and create stop event
|
# ai refactor this chunk ...
|
||||||
self.changed_files = None
|
self.changed_files = None
|
||||||
stop_event = threading.Event()
|
stop_event = threading.Event()
|
||||||
|
|
||||||
|
@ -413,6 +413,7 @@ class InputOutput:
|
||||||
# Start the watcher thread
|
# Start the watcher thread
|
||||||
watcher = threading.Thread(target=watch_files, daemon=True)
|
watcher = threading.Thread(target=watch_files, daemon=True)
|
||||||
watcher.start()
|
watcher.start()
|
||||||
|
# ... to here
|
||||||
|
|
||||||
rel_fnames = list(rel_fnames)
|
rel_fnames = list(rel_fnames)
|
||||||
show = ""
|
show = ""
|
||||||
|
@ -488,7 +489,7 @@ class InputOutput:
|
||||||
self.tool_error(str(err))
|
self.tool_error(str(err))
|
||||||
return ""
|
return ""
|
||||||
finally:
|
finally:
|
||||||
# Clean up the watcher thread
|
# ai: we'll need to adjust this too
|
||||||
stop_event.set()
|
stop_event.set()
|
||||||
watcher.join() # Thread should exit quickly due to stop_event
|
watcher.join() # Thread should exit quickly due to stop_event
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ def load_gitignores(gitignore_paths: list[Path]) -> Optional[PathSpec]:
|
||||||
return PathSpec.from_lines(GitWildMatchPattern, patterns) if patterns else None
|
return PathSpec.from_lines(GitWildMatchPattern, patterns) if patterns else None
|
||||||
|
|
||||||
|
|
||||||
|
# ai: make a class for this that includes the code from io!
|
||||||
def watch_source_files(
|
def watch_source_files(
|
||||||
directory: str,
|
directory: str,
|
||||||
stop_event=None,
|
stop_event=None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue