mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
fix: improve AI comment detection with case-insensitive matching
This commit is contained in:
parent
5b2bd90071
commit
fb005dd01b
1 changed files with 4 additions and 3 deletions
|
@ -11,7 +11,6 @@ from watchfiles import watch
|
||||||
from aider.dump import dump # noqa
|
from aider.dump import dump # noqa
|
||||||
|
|
||||||
|
|
||||||
# ai
|
|
||||||
def is_source_file(path: Path) -> bool:
|
def is_source_file(path: Path) -> bool:
|
||||||
"""
|
"""
|
||||||
Check if a file is a source file that uses # or // style comments.
|
Check if a file is a source file that uses # or // style comments.
|
||||||
|
@ -226,8 +225,10 @@ Be sure to remove all these "ai" comments from the code!
|
||||||
if comment:
|
if comment:
|
||||||
line_nums.append(i)
|
line_nums.append(i)
|
||||||
comments.append(comment)
|
comments.append(comment)
|
||||||
# Use the ai regex, but ensure it's "ai!" ... AI!
|
comment = comment.lower()
|
||||||
if comment.strip().endswith("!"):
|
comment = comment.lstrip("/#-")
|
||||||
|
comment = comment.strip()
|
||||||
|
if comment.startswith("ai!") or comment.endswith("ai!"):
|
||||||
has_bang = True
|
has_bang = True
|
||||||
if not line_nums:
|
if not line_nums:
|
||||||
return None, None, False
|
return None, None, False
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue