Skip to content

Commit 3b1c895

Browse files
authored
Expose a shutdown hook (#666)
1 parent 2103904 commit 3b1c895

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pylsp/hookspecs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,8 @@ def pylsp_signature_help(config, workspace, document, position) -> None:
138138
@hookspec
139139
def pylsp_workspace_configuration_changed(config, workspace) -> None:
140140
pass
141+
142+
143+
@hookspec
144+
def pylsp_shutdown(config, workspace) -> None:
145+
pass

pylsp/python_lsp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ def __getitem__(self, item):
237237
def m_shutdown(self, **_kwargs) -> None:
238238
for workspace in self.workspaces.values():
239239
workspace.close()
240+
self._hook("pylsp_shutdown")
240241
self._shutdown = True
241242

242243
def m_invalid_request_after_shutdown(self, **_kwargs):

0 commit comments

Comments
 (0)