Fixed persisting ident cache

This commit is contained in:
Paul Gauthier 2023-05-30 16:52:28 -07:00
parent 311fc1d6e1
commit 29ca124f5f

View file

@ -3,6 +3,7 @@ import os
import subprocess import subprocess
import sys import sys
import tempfile import tempfile
import json
from collections import Counter, defaultdict from collections import Counter, defaultdict
import networkx as nx import networkx as nx
@ -52,6 +53,7 @@ def fname_to_components(fname, with_colon):
class RepoMap: class RepoMap:
ctags_cmd = ["ctags", "--fields=+S", "--extras=-F", "--output-format=json"] ctags_cmd = ["ctags", "--fields=+S", "--extras=-F", "--output-format=json"]
IDENT_CACHE_FILE = ".aider.ident.cache"
TAGS_CACHE = None TAGS_CACHE = None
IDENT_CACHE = None IDENT_CACHE = None
@ -61,7 +63,7 @@ class RepoMap:
self.root = root self.root = root
self.TAGS_CACHE = dict() self.TAGS_CACHE = dict()
self.IDENT_CACHE = dict() self.load_ident_cache()
if use_ctags is None: if use_ctags is None:
self.use_ctags = self.check_for_ctags() self.use_ctags = self.check_for_ctags()
@ -206,16 +208,6 @@ class RepoMap:
return False return False
return True return True
import json
class RepoMap:
# ...
IDENT_CACHE_FILE = ".aider.ident.cache"
def __init__(self, use_ctags=None, root=None, main_model="gpt-4"):
# ...
self.load_ident_cache()
def load_ident_cache(self): def load_ident_cache(self):
if os.path.exists(self.IDENT_CACHE_FILE): if os.path.exists(self.IDENT_CACHE_FILE):
with open(self.IDENT_CACHE_FILE, "r") as f: with open(self.IDENT_CACHE_FILE, "r") as f: