diff --git a/lib/esbonio/esbonio/server/features/sphinx_manager/client_subprocess.py b/lib/esbonio/esbonio/server/features/sphinx_manager/client_subprocess.py index 4830b7d64..efb98d820 100644 --- a/lib/esbonio/esbonio/server/features/sphinx_manager/client_subprocess.py +++ b/lib/esbonio/esbonio/server/features/sphinx_manager/client_subprocess.py @@ -241,8 +241,7 @@ def _set_state(self, new_state: ClientState): async def stop(self): """Stop the client.""" - if self.state in {ClientState.Running, ClientState.Building}: - self.protocol.notify("exit", None) + self.protocol.notify("exit", None) # Give the agent a little time to close. await asyncio.sleep(0.5) diff --git a/lib/esbonio/tests/e2e/test_sphinx_manager.py b/lib/esbonio/tests/e2e/test_sphinx_manager.py index 59480ae39..2d4ade17d 100644 --- a/lib/esbonio/tests/e2e/test_sphinx_manager.py +++ b/lib/esbonio/tests/e2e/test_sphinx_manager.py @@ -13,7 +13,6 @@ import pytest_asyncio from lsprotocol import types as lsp from pygls import IS_WIN -from pygls.server import StdOutTransportAdapter from esbonio.server import EsbonioLanguageServer from esbonio.server import Uri @@ -50,7 +49,7 @@ async def server_manager(demo_workspace: Uri, docs_workspace): loop = asyncio.get_running_loop() esbonio = create_language_server(EsbonioLanguageServer, [], loop=loop) - esbonio.protocol.transport = StdOutTransportAdapter(io.BytesIO(), sys.stderr.buffer) + esbonio.protocol.set_writer(io.BytesIO()) project_manager = ProjectManager(esbonio) esbonio.add_feature(project_manager) @@ -62,7 +61,7 @@ async def server_manager(demo_workspace: Uri, docs_workspace): async def initialize(init_options): # Initialize the server. - esbonio.protocol._procedure_handler( + esbonio.protocol.handle_message( lsp.InitializeRequest( id=1, params=lsp.InitializeParams( @@ -76,7 +75,7 @@ async def initialize(init_options): ) ) - esbonio.protocol._procedure_handler( + esbonio.protocol.handle_message( lsp.InitializedNotification(params=lsp.InitializedParams()) )