From 130aedc474127f3d8734f324cd5e0a603976b56f Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 25 Oct 2024 16:20:53 -0700 Subject: [PATCH] fix: update regex pattern to match standalone "#ai" comments --- aider/watch.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aider/watch.py b/aider/watch.py index 7f590c247..d02c49d48 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -146,8 +146,7 @@ def get_ai_comment(filepath, encoding="utf-8"): try: with open(filepath, encoding=encoding, errors="ignore") as f: for line in f: - #ai this won't match "#ai" but should. it seems to required a character after - if match := re.search(r"(?:#|//) *ai\b(.*)", line, re.IGNORECASE): + if match := re.search(r"(?:#|//) *ai\b?(.*)", line, re.IGNORECASE): comment = match.group(1).strip() if comment: comments.append(comment)