From 2f78b6f7f3cb48b3c2cde45d9d58918eadf25dc9 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 27 Nov 2024 17:32:12 -0800 Subject: [PATCH] refactor: move FileWatcher initialization to main.py --- aider/io.py | 5 +++-- aider/main.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/aider/io.py b/aider/io.py index 01021a427..69be7e9ab 100644 --- a/aider/io.py +++ b/aider/io.py @@ -198,6 +198,7 @@ class InputOutput: llm_history_file=None, editingmode=EditingMode.EMACS, fancy_input=True, + file_watcher=None, ): self.placeholder = None self.never_prompts = set() @@ -262,6 +263,8 @@ class InputOutput: else: self.console = Console(force_terminal=False, no_color=True) # non-pretty + self.file_watcher = file_watcher + def _get_style(self): style_dict = {} if not self.pretty: @@ -391,8 +394,6 @@ class InputOutput: ): self.rule() - gitignore = [str(Path(root) / ".gitignore")] - self.file_watcher = FileWatcher(root, encoding=self.encoding, gitignores=gitignore) self.file_watcher.start() rel_fnames = list(rel_fnames) diff --git a/aider/main.py b/aider/main.py index ae53f957a..7637c7715 100644 --- a/aider/main.py +++ b/aider/main.py @@ -800,7 +800,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F ignores.append(str(Path(git_root) / ".gitignore")) if args.aiderignore: ignores.append(args.aiderignore) - io.file_watcher = FileWatcher(coder.root, encoding=io.encoding, gitignores=ignores) + FileWatcher(coder, encoding=io.encoding, gitignores=ignores) coder.show_announcements()