99from lsp_client .protocol import CapabilityClientProtocol , TextDocumentCapabilityProtocol
1010from lsp_client .utils .type_guard import is_document_symbols , is_symbol_information_seq
1111from lsp_client .utils .types import AnyPath , lsp_type
12+ from lsp_client .utils .warn import deprecated
1213
1314
1415@runtime_checkable
@@ -25,7 +26,7 @@ class WithRequestDocumentSymbol(
2526 @classmethod
2627 def iter_methods (cls ) -> Iterator [str ]:
2728 yield from super ().iter_methods ()
28- yield from ("text_document/document_symbol" ,)
29+ yield from (lsp_type . TEXT_DOCUMENT_DOCUMENT_SYMBOL ,)
2930
3031 @override
3132 @classmethod
@@ -51,7 +52,7 @@ def check_server_capability(cls, cap: lsp_type.ServerCapabilities) -> None:
5152
5253 async def _request_document_symbol (
5354 self , params : lsp_type .DocumentSymbolParams
54- ) -> lsp_type .DocumentSymbolResponse :
55+ ) -> lsp_type .DocumentSymbolResult | None :
5556 return await self .request (
5657 lsp_type .DocumentSymbolRequest (
5758 id = jsonrpc_uuid (),
@@ -65,14 +66,19 @@ async def request_document_symbol(
6566 ) -> (
6667 Sequence [lsp_type .SymbolInformation ] | Sequence [lsp_type .DocumentSymbol ] | None
6768 ):
68- return await self ._request_document_symbol (
69- lsp_type .DocumentSymbolParams (
70- text_document = lsp_type .TextDocumentIdentifier (
71- uri = self .as_uri (file_path ),
69+ async with self .open_files (file_path ):
70+ return await self ._request_document_symbol (
71+ lsp_type .DocumentSymbolParams (
72+ text_document = lsp_type .TextDocumentIdentifier (
73+ uri = self .as_uri (file_path ),
74+ ),
7275 ),
73- ),
74- )
76+ )
7577
78+ @deprecated (
79+ "Use 'request_document_symbol_information_list' or "
80+ "'request_document_symbol_list' instead."
81+ )
7682 async def request_document_symbol_information_list (
7783 self , file_path : AnyPath
7884 ) -> Sequence [lsp_type .SymbolInformation ] | None :
0 commit comments