mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
refactor: simplify regex pattern for matching AI comments
This commit is contained in:
parent
311e1568d9
commit
9f1b8347f5
1 changed files with 1 additions and 2 deletions
|
@ -113,8 +113,7 @@ def watch_source_files(
|
||||||
with open(path_abs, encoding=encoding, errors="ignore") as f:
|
with open(path_abs, encoding=encoding, errors="ignore") as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
# ai: don't just match at start of line
|
res = bool(re.search(r"(?:#|//) *ai\b", content, re.IGNORECASE))
|
||||||
res = bool(re.search(r"(?:^|\n)(?:#|//) *ai\b", content, re.IGNORECASE))
|
|
||||||
if VERBOSE: dump(res)
|
if VERBOSE: dump(res)
|
||||||
return res
|
return res
|
||||||
except (IOError, UnicodeDecodeError) as err:
|
except (IOError, UnicodeDecodeError) as err:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue