From 7e72ef30bffaecbea3d02fe913c3925d43d3a585 Mon Sep 17 00:00:00 2001 From: Marius Ailinca Date: Fri, 20 Feb 2026 14:20:34 +0200 Subject: [PATCH 1/2] fix: avoid unnecessary didOpen/didClose LSP calls for cached files in full symbol tree request_full_symbol_tree was opening every file in the language server (sending didOpen + didClose notifications) even when document symbols were already cached. For a ~600 file Kotlin project, this caused 1198 unnecessary pipe writes to the LSP process, taking ~9 seconds. By passing open_in_ls=False, files are only read locally for cache validation. The LSP is only notified when a cache miss requires re-parsing. This reduces full-project symbol tree time from ~9.5s to ~0.5s (19x improvement) on cached runs. Co-Authored-By: Claude Opus 4.6 --- src/solidlsp/ls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solidlsp/ls.py b/src/solidlsp/ls.py index bce7863a..7e9cd500 100644 --- a/src/solidlsp/ls.py +++ b/src/solidlsp/ls.py @@ -1406,7 +1406,7 @@ class SolidLanguageServer(ABC): child["parent"] = package_symbol elif os.path.isfile(contained_dir_or_file_abs_path): - with self._open_file_context(contained_dir_or_file_rel_path) as file_data: + with self._open_file_context(contained_dir_or_file_rel_path, open_in_ls=False) as file_data: document_symbols = self.request_document_symbols(contained_dir_or_file_rel_path, file_data) file_root_nodes = document_symbols.root_symbols From 49077e153340ed3640c2c392b9e5d3554a2a72d8 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Fri, 20 Feb 2026 14:59:05 +0100 Subject: [PATCH 2/2] _request_document_symbols: Simplify opening of the file buffer By applying the _open_file_context context manager, we avoid the need for calling ensure_open_in_ls explicitly --- src/solidlsp/ls.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/solidlsp/ls.py b/src/solidlsp/ls.py index 7e9cd500..7dbc0938 100644 --- a/src/solidlsp/ls.py +++ b/src/solidlsp/ls.py @@ -1193,11 +1193,8 @@ class SolidLanguageServer(ABC): return response - if file_data is not None: - return get_raw_document_symbols(file_data) - else: - with self.open_file(relative_file_path) as opened_file_data: - return get_raw_document_symbols(opened_file_data) + with self._open_file_context(relative_file_path, file_buffer=file_data) as fd: + return get_raw_document_symbols(fd) def request_document_symbols(self, relative_file_path: str, file_buffer: LSPFileBuffer | None = None) -> DocumentSymbols: """ @@ -1227,7 +1224,6 @@ class SolidLanguageServer(ABC): log.debug("No cache hit for document symbols in %s", relative_file_path) # no cached result: request the root symbols from the language server - file_data.ensure_open_in_ls() root_symbols = self._request_document_symbols(relative_file_path, file_data) if root_symbols is None: