feat: add support for -- style comments in file watcher

This commit is contained in:
Paul Gauthier (aider) 2024-12-01 18:25:18 -08:00
parent 0ca1886695
commit 981bd950da

View file

@ -43,6 +43,13 @@ def is_source_file(path: Path) -> bool:
".go", ".go",
".rs", ".rs",
".php", ".php",
# -- style comments
".sql",
".hs", # Haskell
".lua",
".elm",
".vhd", # VHDL
".vhdl",
} }
return path.suffix.lower() in COMMENT_STYLE_EXTENSIONS return path.suffix.lower() in COMMENT_STYLE_EXTENSIONS
@ -65,7 +72,7 @@ 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"(?:#|//) *(ai\b.*|ai\b.*|.*\bai!?)$", re.IGNORECASE) ai_comment_pattern = re.compile(r"(?:#|//|--) *(ai\b.*|ai\b.*|.*\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