From ce8069196cba1a13b34023b337ae8c10b6970993 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 14 Jun 2023 16:12:51 -0700 Subject: [PATCH] Improve messaging about universal ctags --- aider/coder.py | 8 ++++++-- aider/repomap.py | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/aider/coder.py b/aider/coder.py index f93a4c79e..a21ccfeb4 100755 --- a/aider/coder.py +++ b/aider/coder.py @@ -117,8 +117,12 @@ class Coder: self.gpt_prompts.repo_content_prefix, ) - if self.repo_map.has_ctags: - self.io.tool_output("Using ctags to build repo-map.") + if self.repo_map.use_ctags: + self.io.tool_output("Using universal-ctags to build repo-map.") + elif not self.repo_map.has_ctags and map_tokens > 0: + self.io.tool_output("Can't find universal-ctags, using basic repo-map.") + else: + self.io.tool_output("Not using repo map.") for fname in self.get_inchat_relative_files(): self.io.tool_output(f"Added {fname} to the chat.") diff --git a/aider/repomap.py b/aider/repomap.py index ce2432d67..2e0459091 100644 --- a/aider/repomap.py +++ b/aider/repomap.py @@ -83,10 +83,12 @@ class RepoMap: self.load_tags_cache() self.max_map_tokens = map_tokens - if map_tokens > 0: - self.has_ctags = self.check_for_ctags() + self.has_ctags = self.check_for_ctags() + + if map_tokens > 0 and self.has_ctags: + self.use_ctags = True else: - self.has_ctags = False + self.use_ctags = False self.tokenizer = tiktoken.encoding_for_model(main_model.name) self.repo_content_prefix = repo_content_prefix @@ -122,7 +124,7 @@ class RepoMap: if not other_files: return - if self.has_ctags: + if self.use_ctags: files_listing = self.get_ranked_tags_map(chat_files, other_files) if files_listing: num_tokens = self.token_count(files_listing)