From 8d81ef811e803d2dd9ba97f9bc7b315619fd9ab1 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 25 Oct 2024 16:05:51 -0700 Subject: [PATCH] refactor: return full match including prefix in get_ai_comment function --- aider/watch.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aider/watch.py b/aider/watch.py index 13c31b8ce..ba0c1b91c 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -142,8 +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): - #ai return the whole thing, including the group0 - comment = match.group(1).strip() + comment = match.group(0).strip() if comment: comments.append(comment) except (IOError, UnicodeDecodeError):