mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
fix: update AI comment extraction to include full match
This commit is contained in:
parent
77f636f949
commit
3d8ec25a33
1 changed files with 1 additions and 1 deletions
|
@ -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,6 +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()
|
||||
if comment:
|
||||
comments.append(comment)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue