mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
refactor: simplify file content check using direct io.read_text and regex search
This commit is contained in:
parent
bd3231d8dd
commit
b5dbb1d39d
1 changed files with 7 additions and 4 deletions
|
@ -105,11 +105,14 @@ class FileWatcher:
|
||||||
|
|
||||||
# Check if file contains AI markers
|
# Check if file contains AI markers
|
||||||
try:
|
try:
|
||||||
# ai: use io.read_text and run the regex on the file!
|
content = self.io.read_text(str(path_abs))
|
||||||
comments = self.get_ai_comment(str(path_abs))
|
if match := self.ai_comment_pattern.search(content):
|
||||||
|
if self.verbose:
|
||||||
|
dump(True)
|
||||||
|
return True
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
dump(bool(comments))
|
dump(False)
|
||||||
return bool(comments)
|
return False
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print("error")
|
print("error")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue