mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
refactor: improve AI comment pattern regex for better matching
This commit is contained in:
parent
5fdbfef028
commit
221b382e69
1 changed files with 4 additions and 2 deletions
|
@ -3,10 +3,11 @@ import threading
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from grep_ast import TreeContext
|
|
||||||
from pathspec import PathSpec
|
from pathspec import PathSpec
|
||||||
from pathspec.patterns import GitWildMatchPattern
|
from pathspec.patterns import GitWildMatchPattern
|
||||||
from watchfiles import watch
|
from watchfiles import watch
|
||||||
|
from grep_ast import TreeContext
|
||||||
|
|
||||||
|
|
||||||
from aider.dump import dump # noqa
|
from aider.dump import dump # noqa
|
||||||
|
|
||||||
|
@ -65,7 +66,8 @@ class FileWatcher:
|
||||||
"""Watches source files for changes and AI comments"""
|
"""Watches source files for changes and AI comments"""
|
||||||
|
|
||||||
# Compiled regex pattern for AI comments
|
# Compiled regex pattern for AI comments
|
||||||
ai_comment_pattern = re.compile(r"(?:#|//) *.*\bai!? *$", re.IGNORECASE)
|
ai_comment_pattern = re.compile(r"(?:#|//) *(ai\b.*|ai|.*\bai!?)", re.IGNORECASE)
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, coder, gitignores=None, verbose=False):
|
def __init__(self, coder, gitignores=None, verbose=False):
|
||||||
self.coder = coder
|
self.coder = coder
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue