mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
feat: Add file modification time to cache key for render_tree
This commit is contained in:
parent
56210468f7
commit
884ee535af
1 changed files with 5 additions and 4 deletions
|
@ -532,12 +532,13 @@ class RepoMap:
|
||||||
tree_cache = dict()
|
tree_cache = dict()
|
||||||
|
|
||||||
def render_tree(self, abs_fname, rel_fname, lois):
|
def render_tree(self, abs_fname, rel_fname, lois):
|
||||||
key = (rel_fname, tuple(sorted(lois)))
|
mtime = self.get_mtime(abs_fname)
|
||||||
|
key = (rel_fname, tuple(sorted(lois)), mtime)
|
||||||
|
|
||||||
if key in self.tree_cache:
|
if key in self.tree_cache:
|
||||||
return self.tree_cache[key]
|
return self.tree_cache[key]
|
||||||
|
|
||||||
if rel_fname not in self.tree_context_cache:
|
if rel_fname not in self.tree_context_cache or self.tree_context_cache[rel_fname]['mtime'] != mtime:
|
||||||
code = self.io.read_text(abs_fname) or ""
|
code = self.io.read_text(abs_fname) or ""
|
||||||
if not code.endswith("\n"):
|
if not code.endswith("\n"):
|
||||||
code += "\n"
|
code += "\n"
|
||||||
|
@ -555,9 +556,9 @@ class RepoMap:
|
||||||
# header_max=30,
|
# header_max=30,
|
||||||
show_top_of_file_parent_scope=False,
|
show_top_of_file_parent_scope=False,
|
||||||
)
|
)
|
||||||
self.tree_context_cache[rel_fname] = context
|
self.tree_context_cache[rel_fname] = {'context': context, 'mtime': mtime}
|
||||||
|
|
||||||
context = self.tree_context_cache[rel_fname]
|
context = self.tree_context_cache[rel_fname]['context']
|
||||||
context.lines_of_interest = set()
|
context.lines_of_interest = set()
|
||||||
context.add_lines_of_interest(lois)
|
context.add_lines_of_interest(lois)
|
||||||
context.add_context()
|
context.add_context()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue