Improve docstring for LanguageServerSymbolRetriever to clarify symbol processing criteria

This commit is contained in:
Roman Nikulenkov committed 2026-01-19 14:06:58 +03:00
1 parent 44696c6362
commit e9cca73889
2 files changed
+8 -14

No files matched your search

+1 -1
View File
@@ -549,7 +549,7 @@ class LanguageServerSymbolRetriever:
requests. If exceeded, remaining symbols get info=None (partial results).
:param symbols: list of symbols to get info for
:return: a dict mapping each symbol to its info (or None if unavailable)
:return: a dict mapping each processable symbol to its info (or None if unavailable). Symbols with missing location attributes (relative_path/line/column is None) are skipped and omitted from the result.
"""
if not symbols:
return {}
+7 -13
View File
@@ -1050,21 +1050,18 @@ class SolidLanguageServer(ABC):
def get_cached_raw_document_symbols(cache_key: str, fd: LSPFileBuffer) -> list[SymbolInformation] | list[DocumentSymbol] | None:
file_hash_and_result = self._raw_document_symbols_cache.get(cache_key)
if file_hash_and_result is None:
log.debug("No cache hit for raw document symbols symbols in %s", relative_file_path)
if log.isEnabledFor(logging.DEBUG):
log.debug("perf: raw_document_symbols_cache MISS path=%s", relative_file_path)
log.debug("No cache hit for raw document symbols in %s", relative_file_path)
log.debug("perf: raw_document_symbols_cache MISS path=%s", relative_file_path)
return None
file_hash, result = file_hash_and_result
if file_hash == fd.content_hash:
log.debug("Returning cached raw document symbols for %s", relative_file_path)
if log.isEnabledFor(logging.DEBUG):
log.debug("perf: raw_document_symbols_cache HIT path=%s", relative_file_path)
log.debug("perf: raw_document_symbols_cache HIT path=%s", relative_file_path)
return result
log.debug("Document content for %s has changed (raw symbol cache is not up-to-date)", relative_file_path)
if log.isEnabledFor(logging.DEBUG):
log.debug("perf: raw_document_symbols_cache STALE path=%s", relative_file_path)
log.debug("perf: raw_document_symbols_cache STALE path=%s", relative_file_path)
return None
def get_raw_document_symbols(fd: LSPFileBuffer) -> list[SymbolInformation] | list[DocumentSymbol] | None:
@@ -1111,19 +1108,16 @@ class SolidLanguageServer(ABC):
file_hash_and_result = self._document_symbols_cache.get(cache_key)
if file_hash_and_result is None:
log.debug("No cache hit for document symbols in %s", relative_file_path)
if log.isEnabledFor(logging.DEBUG):
log.debug("perf: document_symbols_cache MISS path=%s", relative_file_path)
log.debug("perf: document_symbols_cache MISS path=%s", relative_file_path)
else:
file_hash, document_symbols = file_hash_and_result
if file_hash == file_data.content_hash:
log.debug("Returning cached document symbols for %s", relative_file_path)
if log.isEnabledFor(logging.DEBUG):
log.debug("perf: document_symbols_cache HIT path=%s", relative_file_path)
log.debug("perf: document_symbols_cache HIT path=%s", relative_file_path)
return document_symbols
log.debug("Cached document symbol content for %s has changed", relative_file_path)
if log.isEnabledFor(logging.DEBUG):
log.debug("perf: document_symbols_cache STALE path=%s", relative_file_path)
log.debug("perf: document_symbols_cache STALE path=%s", relative_file_path)
# no cached result: request the root symbols from the language server
root_symbols = self._request_document_symbols(relative_file_path, file_data)