mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
feat: add file watcher support to coder cloning
This commit is contained in:
parent
a1d558a960
commit
6b8e235f88
3 changed files with 22 additions and 4 deletions
|
@ -103,6 +103,7 @@ class Coder:
|
|||
detect_urls = True
|
||||
ignore_mentions = None
|
||||
chat_language = None
|
||||
file_watcher = None
|
||||
|
||||
@classmethod
|
||||
def create(
|
||||
|
@ -153,10 +154,12 @@ class Coder:
|
|||
aider_commit_hashes=from_coder.aider_commit_hashes,
|
||||
commands=from_coder.commands.clone(),
|
||||
total_cost=from_coder.total_cost,
|
||||
ignore_mentions=from_coder.ignore_mentions,
|
||||
file_watcher=from_coder.file_watcher,
|
||||
)
|
||||
|
||||
use_kwargs.update(update) # override to complete the switch
|
||||
use_kwargs.update(kwargs) # override passed kwargs
|
||||
dump(use_kwargs)
|
||||
|
||||
kwargs = use_kwargs
|
||||
|
||||
|
@ -175,7 +178,6 @@ class Coder:
|
|||
|
||||
def clone(self, **kwargs):
|
||||
new_coder = Coder.create(from_coder=self, **kwargs)
|
||||
new_coder.ignore_mentions = self.ignore_mentions
|
||||
return new_coder
|
||||
|
||||
def get_announcements(self):
|
||||
|
@ -283,6 +285,9 @@ class Coder:
|
|||
suggest_shell_commands=True,
|
||||
chat_language=None,
|
||||
detect_urls=True,
|
||||
ignore_mentions=None,
|
||||
file_watcher=None,
|
||||
|
||||
):
|
||||
# Fill in a dummy Analytics if needed, but it is never .enable()'d
|
||||
self.analytics = analytics if analytics is not None else Analytics()
|
||||
|
@ -293,7 +298,14 @@ class Coder:
|
|||
self.aider_commit_hashes = set()
|
||||
self.rejected_urls = set()
|
||||
self.abs_root_path_cache = {}
|
||||
self.ignore_mentions = set()
|
||||
|
||||
self.ignore_mentions = ignore_mentions
|
||||
if not self.ignore_mentions:
|
||||
self.ignore_mentions = set()
|
||||
|
||||
self.file_watcher = file_watcher
|
||||
if self.file_watcher:
|
||||
self.file_watcher.coder = self
|
||||
|
||||
self.suggest_shell_commands = suggest_shell_commands
|
||||
self.detect_urls = detect_urls
|
||||
|
|
|
@ -43,6 +43,8 @@ class Commands:
|
|||
verify_ssl=self.verify_ssl,
|
||||
args=self.args,
|
||||
parser=self.parser,
|
||||
verbose=self.verbose,
|
||||
editor=self.editor,
|
||||
)
|
||||
|
||||
def __init__(
|
||||
|
@ -997,6 +999,7 @@ class Commands:
|
|||
|
||||
if not args.strip():
|
||||
self.basic_help()
|
||||
dump(self.coder)
|
||||
return
|
||||
|
||||
self.coder.event("interactive help")
|
||||
|
|
|
@ -822,7 +822,8 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
|||
ignores.append(args.aiderignore)
|
||||
|
||||
if args.watch_files:
|
||||
FileWatcher(coder, gitignores=ignores, verbose=args.verbose)
|
||||
file_watcher = FileWatcher(coder, gitignores=ignores, verbose=args.verbose)
|
||||
coder.file_watcher = file_watcher
|
||||
|
||||
coder.show_announcements()
|
||||
|
||||
|
@ -946,7 +947,9 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
|||
if "show_announcements" in kwargs:
|
||||
del kwargs["show_announcements"]
|
||||
|
||||
dump(hash(coder.file_watcher), coder.file_watcher)
|
||||
coder = Coder.create(**kwargs)
|
||||
dump(hash(coder.file_watcher), coder.file_watcher)
|
||||
|
||||
if switch.kwargs.get("show_announcements") is not False:
|
||||
coder.show_announcements()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue