mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
refactor: return full match including prefix in get_ai_comment function
This commit is contained in:
parent
3d8ec25a33
commit
8d81ef811e
1 changed files with 1 additions and 2 deletions
|
@ -142,8 +142,7 @@ def get_ai_comment(filepath, encoding="utf-8"):
|
||||||
with open(filepath, encoding=encoding, errors="ignore") as f:
|
with open(filepath, encoding=encoding, errors="ignore") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
if match := re.search(r"(?:#|//) *ai\b(.*)", line, re.IGNORECASE):
|
if match := re.search(r"(?:#|//) *ai\b(.*)", line, re.IGNORECASE):
|
||||||
#ai return the whole thing, including the group0
|
comment = match.group(0).strip()
|
||||||
comment = match.group(1).strip()
|
|
||||||
if comment:
|
if comment:
|
||||||
comments.append(comment)
|
comments.append(comment)
|
||||||
except (IOError, UnicodeDecodeError):
|
except (IOError, UnicodeDecodeError):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue