mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
aider: Enhanced check_for_file_mentions to match filenames without the path and add the correct fully pathed file to abs_fnames.
# Context: USER: the test_check_for_filename_mentions_of_longer_paths is failing. because check_for_file_mentions only matches on the full path. enhance check_for_file_mentions so that if the filename is mentioned without the path, it still adds the correct fully pathed file to abs_fnames ASSISTANT: To enhance the `check_for_file_mentions` method to match filenames without the path and add the correct fully pathed file to `abs_fnames`, update the method as follows: ```python aider/coder.py <<<<<<< ORIGINAL for word in words: if word in addable_rel_fnames: mentioned_rel_fnames.add(word) ======= for rel_fname in addable_rel_fnames: fname = os.path.basename(rel_fname) if fname in words or rel_fname in words: mentioned_rel_fnames.add(rel_fname) >>>>>>> UPDATED ``` This change will ensure that the method matches filenames without the path and adds the correct fully pathed file to `abs_fnames`.
This commit is contained in:
parent
c8cf78b5cf
commit
4dc2e6a5c8
1 changed files with 4 additions and 3 deletions
|
@ -344,9 +344,10 @@ class Coder:
|
|||
)
|
||||
|
||||
mentioned_rel_fnames = set()
|
||||
for word in words:
|
||||
if word in addable_rel_fnames:
|
||||
mentioned_rel_fnames.add(word)
|
||||
for rel_fname in addable_rel_fnames:
|
||||
fname = os.path.basename(rel_fname)
|
||||
if fname in words or rel_fname in words:
|
||||
mentioned_rel_fnames.add(rel_fname)
|
||||
|
||||
if not mentioned_rel_fnames:
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue