@@ -1210,7 +1210,6 @@ def retrieve_symbol_body(self, symbol: multilspy_types.UnifiedSymbolInformation
12101210 symbol_body = symbol_body [symbol_start_column :]
12111211 return symbol_body
12121212
1213-
12141213 async def request_parsed_files (self ) -> list [str ]:
12151214 """Retrieves relative paths of all files analyzed by the Language Server."""
12161215 if not self .server_started :
@@ -1221,13 +1220,9 @@ async def request_parsed_files(self) -> list[str]:
12211220 raise MultilspyException ("Language Server not started" )
12221221 rel_file_paths = []
12231222 for root , dirs , files in os .walk (self .repository_root_path ):
1224- # Don't go into directories that are ignored by modifying dirs inplace
1225- # Explanation for the + "/" part:
1226- # pathspec can't handle the matching of directories if they don't end with a slash!
1227- # see https://github.com/cpburnz/python-pathspec/issues/89
1228- dirs [:] = [d for d in dirs if not self .is_ignored_path (os .path .join (root , d ) + "/" )]
1223+ dirs [:] = [d for d in dirs if not self .is_ignored_path (os .path .join (root , d ))]
12291224 for file in files :
1230- rel_file_path = os .path .join (root , file )
1225+ rel_file_path = os .path .relpath ( os . path . join (root , file ), start = self . repository_root_path )
12311226 if not self .is_ignored_path (rel_file_path ):
12321227 rel_file_paths .append (rel_file_path )
12331228 return rel_file_paths
@@ -1596,7 +1591,10 @@ async def request_defining_symbol(
15961591 return defining_symbol
15971592
15981593 @property
1599- def _cache_path (self ) -> Path :
1594+ def cache_path (self ) -> Path :
1595+ """
1596+ The path to the cache file for the document symbols.
1597+ """
16001598 return Path (self .repository_root_path ) / ".serena" / "cache" / self .language_id / "document_symbols_cache_v20-05-25.pkl"
16011599
16021600 async def index_repository (self , progress_bar : bool = True , save_after_n_files : int = 10 ) -> None :
@@ -1623,33 +1621,33 @@ def save_cache(self):
16231621 self .logger .log ("No changes to document symbols cache, skipping save" , logging .DEBUG )
16241622 return
16251623
1626- self .logger .log (f"Saving updated document symbols cache to { self ._cache_path } " , logging .INFO )
1627- self ._cache_path .parent .mkdir (parents = True , exist_ok = True )
1624+ self .logger .log (f"Saving updated document symbols cache to { self .cache_path } " , logging .INFO )
1625+ self .cache_path .parent .mkdir (parents = True , exist_ok = True )
16281626 try :
1629- with open (self ._cache_path , "wb" ) as f :
1627+ with open (self .cache_path , "wb" ) as f :
16301628 pickle .dump (self ._document_symbols_cache , f )
16311629 self ._cache_has_changed = False
16321630 except Exception as e :
16331631 self .logger .log (
1634- f"Failed to save document symbols cache to { self ._cache_path } : { e } . "
1632+ f"Failed to save document symbols cache to { self .cache_path } : { e } . "
16351633 "Note: this may have resulted in a corrupted cache file." ,
16361634 logging .ERROR ,
16371635 )
16381636
16391637 def load_cache (self ):
1640- if not self ._cache_path .exists ():
1638+ if not self .cache_path .exists ():
16411639 return
16421640
16431641 with self ._cache_lock :
1644- self .logger .log (f"Loading document symbols cache from { self ._cache_path } " , logging .INFO )
1642+ self .logger .log (f"Loading document symbols cache from { self .cache_path } " , logging .INFO )
16451643 try :
1646- with open (self ._cache_path , "rb" ) as f :
1644+ with open (self .cache_path , "rb" ) as f :
16471645 self ._document_symbols_cache = pickle .load (f )
16481646 self .logger .log (f"Loaded { len (self ._document_symbols_cache )} document symbols from cache." , logging .INFO )
16491647 except Exception as e :
16501648 # cache often becomes corrupt, so just skip loading it
16511649 self .logger .log (
1652- f"Failed to load document symbols cache from { self ._cache_path } : { e } . Possible cause: the cache file is corrupted. "
1650+ f"Failed to load document symbols cache from { self .cache_path } : { e } . Possible cause: the cache file is corrupted. "
16531651 "Check for any errors related to saving the cache in the logs." ,
16541652 logging .ERROR ,
16551653 )
@@ -1704,6 +1702,13 @@ def __init__(self, language_server: LanguageServer, timeout: Optional[float] = N
17041702 self ._shutdown_lock = threading .Lock ()
17051703 self ._is_shutting_down = False
17061704
1705+ @property
1706+ def cache_path (self ) -> Path :
1707+ """
1708+ The path to the cache file for the document symbols.
1709+ """
1710+ return self .language_server .cache_path
1711+
17071712 @classmethod
17081713 def create (
17091714 cls , config : MultilspyConfig , logger : MultilspyLogger , repository_root_path : str ,
0 commit comments