diff --git a/aider/io.py b/aider/io.py index 26c4d091a..75a2d7cdb 100644 --- a/aider/io.py +++ b/aider/io.py @@ -378,7 +378,7 @@ class InputOutput: if changed: self.changed_files = changed - #ai move all this ... + # ai move all this ... self.changed_files = process_file_changes(changed) self.interrupt_input() break @@ -447,7 +447,7 @@ class InputOutput: # Check if we were interrupted by a file change if self.changed_files: - #ai ...down to here! + # ai ...down to here! changed = " ".join(self.changed_files) self.changed_files = None diff --git a/aider/watch.py b/aider/watch.py index 5e623337e..d9d5d4856 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -135,24 +135,16 @@ def watch_source_files( result[file] = comments yield result + def process_file_changes(changed): """Process file changes and handle special ! comments""" - if any( - "!" in comment - for comments in changed.values() - if comments - for comment in comments - ): + if any("!" in comment for comments in changed.values() if comments for comment in comments): return [ - "\n".join( - comment - for comments in changed.values() - if comments - for comment in comments - ) + "\n".join(comment for comments in changed.values() if comments for comment in comments) ] return list(changed.keys()) + def get_ai_comment(filepath, encoding="utf-8"): """Extract all AI comments from a file""" comments = []