mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 11:14:59 +00:00
fix: extract AI comment content without prefix in file watcher
This commit is contained in:
parent
ec00bb988c
commit
2e5981ecb3
2 changed files with 5 additions and 2 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,7 +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):
|
||||
comment = match.group(0).strip()
|
||||
comment = match.group(1).strip()
|
||||
if comment:
|
||||
comments.append(comment)
|
||||
except (IOError, UnicodeDecodeError):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue