From 2e5981ecb39c53f33abfe93c8d424134970d1ac7 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 25 Oct 2024 16:10:48 -0700 Subject: [PATCH] fix: extract AI comment content without prefix in file watcher --- aider/io.py | 4 ++++ aider/watch.py | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/aider/io.py b/aider/io.py index 91805fc0e..48d812d68 100644 --- a/aider/io.py +++ b/aider/io.py @@ -376,6 +376,9 @@ class InputOutput: root, stop_event=stop_event, gitignores=gitignore, encoding=self.encoding ): if changed: + self.changed_files = changed + + #ai move all this ... dump(changed) # Check if any values contain ! if any( @@ -461,6 +464,7 @@ class InputOutput: # Check if we were interrupted by a file change if self.changed_files: + #ai ...down to here! changed = " ".join(self.changed_files) self.changed_files = None diff --git a/aider/watch.py b/aider/watch.py index 51e897c98..3a0830ebe 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -135,7 +135,6 @@ def watch_source_files( result[file] = comments yield result - def get_ai_comment(filepath, encoding="utf-8"): """Extract all AI comments from a file""" comments = [] @@ -143,7 +142,7 @@ def get_ai_comment(filepath, encoding="utf-8"): with open(filepath, encoding=encoding, errors="ignore") as f: for line in f: if match := re.search(r"(?:#|//) *ai\b(.*)", line, re.IGNORECASE): - comment = match.group(0).strip() + comment = match.group(1).strip() if comment: comments.append(comment) except (IOError, UnicodeDecodeError):