diff --git a/aider/coder.py b/aider/coder.py index f257f16ed..680d16286 100755 --- a/aider/coder.py +++ b/aider/coder.py @@ -164,8 +164,7 @@ class Coder: all_content = files_content if self.repo is not None: - tracked_files = set(self.repo.git.ls_files().splitlines()) - files_listing = "\n".join(tracked_files) + files_listing = get_tags_map(self.get_all_abs_files()) repo_content = prompts.repo_content_prefix repo_content += files_listing @@ -180,6 +179,7 @@ class Coder: ), ] + utils.show_messages(messages, "FILES") return files_messages def run(self): diff --git a/aider/ctags.py b/aider/ctags.py index b254c37bc..38c4dd8b7 100644 --- a/aider/ctags.py +++ b/aider/ctags.py @@ -6,10 +6,13 @@ import subprocess # from aider.dump import dump -def get_tags_map(filenames): +def get_tags_map(filenames, root_dname=None): + if not root_dname: + root_dname = os.getcwd() + tags = [] for filename in filenames: - tags += get_tags(filename) + tags += get_tags(filename, root_dname) if not tags: return @@ -32,16 +35,16 @@ def get_tags_map(filenames): return output -def split_path(path): - path = os.path.relpath(path, os.getcwd()) +def split_path(path, root_dname): + path = os.path.relpath(path, root_dname) path_components = path.split(os.sep) res = [pc + os.sep for pc in path_components[:-1]] res.append(path_components[-1]) return res -def get_tags(filename): - yield split_path(filename) +def get_tags(filename, root_dname): + yield split_path(filename, root_dname) cmd = ["ctags", "--fields=+S", "--output-format=json", filename] output = subprocess.check_output(cmd).decode("utf-8") diff --git a/aider/prompts.py b/aider/prompts.py index e17b69c1d..9ce7946f3 100644 --- a/aider/prompts.py +++ b/aider/prompts.py @@ -79,10 +79,10 @@ files_content_gpt_no_edits = "I wasn't able to see any properly formatted edits files_content_local_edits = "I made some changes to the files myself." -repo_content_prefix = "These are the files in the git repo:\n\n" +repo_content_prefix = "Here is a map showing all the other files and their content:\n\n" files_content_prefix = ( - "These are the *ONLY* files you can propose changes to (ask if you need to see others):\n\n" + "You can propose changes to *only* these files (ask if you need to see others):\n\n" ) files_content_suffix = (