Skip to content

Commit ee104b0

Browse files
committed
Add assertion string to references and document_symbol requests to language server
These endpoints could return `None` in case the symbol is one that's not found. Adding the assertion string can help caller catch these exceptions and handle the errors as appropriate.
1 parent 627841c commit ee104b0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/multilspy/language_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ async def request_references(
467467
)
468468

469469
ret: List[multilspy_types.Location] = []
470-
assert isinstance(response, list)
470+
assert isinstance(response, list), f"Unexpected response from Language Server: {response}"
471471
for item in response:
472472
assert isinstance(item, dict)
473473
assert LSPConstants.URI in item
@@ -597,7 +597,7 @@ async def request_document_symbols(self, relative_file_path: str) -> Tuple[List[
597597

598598
ret: List[multilspy_types.UnifiedSymbolInformation] = []
599599
l_tree = None
600-
assert isinstance(response, list)
600+
assert isinstance(response, list), f"Unexpected response from Language Server: {response}"
601601
for item in response:
602602
assert isinstance(item, dict)
603603
assert LSPConstants.NAME in item

0 commit comments

Comments
 (0)