From 8b7fa6f84585d447ac773282075db88e04b9e8ec Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Sun, 1 Dec 2024 07:55:39 -0800 Subject: [PATCH] refactor: move bang checking logic earlier in file processing flow --- aider/watch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aider/watch.py b/aider/watch.py index 5797ba051..e10254732 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -162,8 +162,11 @@ class FileWatcher: def process_changes(self): """Get any detected file changes""" + has_bangs = False for fname in self.changed_files: - # ai actually, check for bangs up here, not down below! + _, _, has_bang = self.get_ai_comments(fname) + has_bangs |= has_bang + if fname in self.coder.abs_fnames: continue self.coder.abs_fnames.add(fname) @@ -173,7 +176,6 @@ class FileWatcher: # Refresh all AI comments from tracked files ai_comments = {} - has_bangs = False for fname in self.coder.abs_fnames: line_nums, comments, has_bang = self.get_ai_comments(fname) if line_nums: