From 791cbab6f66c5c19c876127314e7d27a61e0b8f3 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sun, 1 Dec 2024 15:25:47 -0800 Subject: [PATCH] refactor: use get_ai_comments() instead of duplicating pattern matching --- aider/watch.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/aider/watch.py b/aider/watch.py index 0a0e74290..743b14e2c 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -108,11 +108,8 @@ class FileWatcher: # Check if file contains AI markers try: - # TODO: use get_ai_comments() for this - with open(str(path_abs), "r", encoding=self.io.encoding) as f: - content = f.read() - match = self.ai_comment_pattern.search(content) - return bool(match) + _, _, has_match = self.get_ai_comments(str(path_abs)) + return has_match except Exception: return