Skip to content

Commit 5097d3c

Browse files
committed
Fix: Prevent server crash on shutdown if not initialized
Check if self.config is None in _hook to avoid AttributeError when shutdown is called without a prior successful initialize request. Signed-off-by: Matěj Cepl <[email protected]>
1 parent bc1095f commit 5097d3c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pylsp/python_lsp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ def _match_uri_to_workspace(self, uri):
266266

267267
def _hook(self, hook_name, doc_uri=None, **kwargs):
268268
"""Calls hook_name and returns a list of results from all registered handlers"""
269+
if self.config is None:
270+
return []
269271
workspace = self._match_uri_to_workspace(doc_uri)
270272
doc = workspace.get_document(doc_uri) if doc_uri else None
271273
hook_handlers = self.config.plugin_manager.subset_hook_caller(

0 commit comments

Comments
 (0)