refactor: use get_ai_comment method instead of direct regex matching

This commit is contained in:
Paul Gauthier (aider) 2024-12-01 07:25:51 -08:00
parent 014aeccde6
commit 56aaa08224

View file

@ -102,12 +102,10 @@ class FileWatcher:
# Check if file contains AI markers
try:
#ai use self.ai_comments() instead!
content = self.io.read_text(str(path_abs))
res = bool(re.search(r"(?:#|//) *ai\b", content, re.IGNORECASE))
comments = self.get_ai_comment(str(path_abs))
if self.verbose:
dump(res)
return res
dump(bool(comments))
return bool(comments)
except Exception as err:
if self.verbose:
print("error")