diff --git a/aider/commands.py b/aider/commands.py index f48873049..b6ece0373 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -404,6 +404,7 @@ class Commands: fence = "`" * 3 + file_res = [] # files for fname in self.coder.abs_fnames: relative_fname = self.coder.get_rel_fname(fname) @@ -414,7 +415,7 @@ class Commands: # approximate content = f"{relative_fname}\n{fence}\n" + content + "{fence}\n" tokens = self.coder.main_model.token_count(content) - res.append((tokens, f"{relative_fname}", "/drop to remove")) + file_res.append((tokens, f"{relative_fname}", "/drop to remove")) # read-only files for fname in self.coder.abs_read_only_fnames: @@ -424,7 +425,10 @@ class Commands: # approximate content = f"{relative_fname}\n{fence}\n" + content + "{fence}\n" tokens = self.coder.main_model.token_count(content) - res.append((tokens, f"{relative_fname} (read-only)", "/drop to remove")) + file_res.append((tokens, f"{relative_fname} (read-only)", "/drop to remove")) + + file_res.sort() + res.extend(file_res) self.io.tool_output( f"Approximate context window usage for {self.coder.main_model.name}, in tokens:"