From 05daab24a28aad942fa6d4d864496882a55b4a44 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 25 Oct 2024 16:03:37 -0700 Subject: [PATCH] fix: update regex pattern for AI comment detection --- aider/watch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/watch.py b/aider/watch.py index bb8aef1e7..8cb2486c7 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -135,13 +135,13 @@ def watch_source_files( result[file] = comment yield result - +#ai return a list of all the ai comments in each file def get_ai_comment(filepath, encoding="utf-8"): """Extract AI comment from a file if present""" try: with open(filepath, encoding=encoding, errors="ignore") as f: for line in f: - if match := re.search(r"(?:#|//) *ai:? *(.*)", line, re.IGNORECASE): + if match := re.search(r"(?:#|//) *ai\b(.*)", line, re.IGNORECASE): return match.group(1).strip() except (IOError, UnicodeDecodeError): return None