mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-15 00:18:04 +00:00
LS: stop no longer raises if LS is not running
This commit is contained in:
1 parent
8d5664bf12
commit
b19a564c9f
1 file changed
+7
-4
@@ -1847,11 +1847,14 @@ class SyncLanguageServer:
|
||||
def stop(self) -> None:
|
||||
"""
|
||||
Shuts down the language server process and cleans up resources.
|
||||
Must be called after start().
|
||||
|
||||
If the language server is not running, this method will log a warning and do nothing.
|
||||
"""
|
||||
if not self.loop or not self.loop_thread:
|
||||
raise MultilspyException("Language Server not started")
|
||||
|
||||
if not self.is_running():
|
||||
self.language_server.logger.log("Language server not running, skipping shutdown.", logging.INFO)
|
||||
return
|
||||
|
||||
assert self.loop
|
||||
asyncio.run_coroutine_threadsafe(self._server_context.__aexit__(None, None, None), loop=self.loop).result()
|
||||
self.loop.call_soon_threadsafe(self.loop.stop)
|
||||
self.loop_thread.join()
|
||||
|
||||
Reference in new issue
Block a user