mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
cache tags
This commit is contained in:
parent
5b99281d86
commit
a941c5cb82
1 changed files with 19 additions and 0 deletions
|
@ -156,6 +156,25 @@ class RepoMap:
|
||||||
self.io.tool_error(f"File not found error: {fname}")
|
self.io.tool_error(f"File not found error: {fname}")
|
||||||
|
|
||||||
def get_tags(self, fname, rel_fname):
|
def get_tags(self, fname, rel_fname):
|
||||||
|
# Check if the file is in the cache and if the modification time has not changed
|
||||||
|
file_mtime = self.get_mtime(fname)
|
||||||
|
if file_mtime is None:
|
||||||
|
return []
|
||||||
|
|
||||||
|
cache_key = fname
|
||||||
|
if cache_key in self.TAGS_CACHE and self.TAGS_CACHE[cache_key]["mtime"] == file_mtime:
|
||||||
|
return self.TAGS_CACHE[cache_key]["data"]
|
||||||
|
|
||||||
|
# miss!
|
||||||
|
|
||||||
|
data = list(self.get_tags_raw(fname, rel_fname))
|
||||||
|
|
||||||
|
# Update the cache
|
||||||
|
self.TAGS_CACHE[cache_key] = {"mtime": file_mtime, "data": data}
|
||||||
|
self.save_tags_cache()
|
||||||
|
return data
|
||||||
|
|
||||||
|
def get_tags_raw(self, fname, rel_fname):
|
||||||
lang = filename_to_lang(fname)
|
lang = filename_to_lang(fname)
|
||||||
if not lang:
|
if not lang:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue