From fb005dd01b002130d882948ac24c9ec10561a69f Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 2 Dec 2024 08:57:50 -0800 Subject: [PATCH] fix: improve AI comment detection with case-insensitive matching --- aider/watch.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/aider/watch.py b/aider/watch.py index 4a34e5cbc..a443ee202 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -11,7 +11,6 @@ from watchfiles import watch from aider.dump import dump # noqa -# ai def is_source_file(path: Path) -> bool: """ Check if a file is a source file that uses # or // style comments. @@ -226,8 +225,10 @@ Be sure to remove all these "ai" comments from the code! if comment: line_nums.append(i) comments.append(comment) - # Use the ai regex, but ensure it's "ai!" ... AI! - if comment.strip().endswith("!"): + comment = comment.lower() + comment = comment.lstrip("/#-") + comment = comment.strip() + if comment.startswith("ai!") or comment.endswith("ai!"): has_bang = True if not line_nums: return None, None, False