mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
fix: improve regex pattern for AI comment detection
This commit is contained in:
parent
4298ae00a9
commit
c26d7d23b5
1 changed files with 4 additions and 3 deletions
|
@ -8,6 +8,7 @@ from watchfiles import watch
|
||||||
|
|
||||||
from aider.dump import dump # noqa
|
from aider.dump import dump # noqa
|
||||||
|
|
||||||
|
#ai turn off verbose!
|
||||||
VERBOSE = True
|
VERBOSE = True
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,9 +145,9 @@ def get_ai_comment(filepath, encoding="utf-8"):
|
||||||
comments = []
|
comments = []
|
||||||
try:
|
try:
|
||||||
with open(filepath, encoding=encoding, errors="ignore") as f:
|
with open(filepath, encoding=encoding, errors="ignore") as f:
|
||||||
for line in f: # ai
|
for line in f:
|
||||||
if match := re.search(r"(?:#|//) *ai(\b.*)?", line, re.IGNORECASE):
|
if match := re.search(r"(?:#|//) *(ai\b.*|ai)", line, re.IGNORECASE):
|
||||||
comment = match.group(1).strip()
|
comment = match.group(0).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