mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 06:17:58 +00:00
Use get() method for safer access to document root properties in LanguageServer
This commit is contained in:
1 parent
da3ad9ad4d
commit
5cb291f096
1 file changed
+4
-4
@@ -1046,10 +1046,10 @@ class LanguageServer:
|
||||
_, document_roots = await self.request_document_symbols(relative_file_path)
|
||||
return [
|
||||
(
|
||||
root["name"],
|
||||
root["kind"],
|
||||
root["selectionRange"]["start"]["line"], # type: ignore
|
||||
root["selectionRange"]["start"]["character"] # type: ignore
|
||||
root.get("name"),
|
||||
root.get("kind"),
|
||||
root.get("selectionRange", {}).get("start", {}).get("line"), # type: ignore
|
||||
root.get("selectionRange", {}).get("start", {}).get("character"), # type: ignore
|
||||
)
|
||||
for root in document_roots
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user