_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
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-02-20 14:59:05 +01:00
1 parent 7e72ef30bf
commit 49077e1533
1 file changed
+2 -6
+2 -6
View File
@@ -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: