From 6a1d879870fb670db507009df7c86d29571d3de5 Mon Sep 17 00:00:00 2001 From: Gaweringo <40121865+Gaweringo@users.noreply.github.com> Date: Thu, 2 Oct 2025 00:42:20 +0200 Subject: [PATCH] fix handling of shutdown request and exit notification vhdl_ls did not quit/exit after receiving the shutdown request and exit notification, because the lsp_server handle_shutdown request already waits for the exit notification and only returns true, if it is received. With the old setup the handler for the exit notification was never called, because handle_shutdown consumed the notification. fixes #142 --- vhdl_ls/src/stdio_server.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/vhdl_ls/src/stdio_server.rs b/vhdl_ls/src/stdio_server.rs index ca168547f..c1205b8b7 100644 --- a/vhdl_ls/src/stdio_server.rs +++ b/vhdl_ls/src/stdio_server.rs @@ -88,9 +88,10 @@ impl ConnectionRpcChannel { match message { lsp_server::Message::Request(request) => { match self.connection.handle_shutdown(&request) { - Ok(shutdown) => { - if shutdown { + Ok(should_exit) => { + if should_exit { server.shutdown_server(); + server.exit_notification(); } else { self.handle_request(&mut server, request) } @@ -272,11 +273,6 @@ impl ConnectionRpcChannel { Ok(params) => return server.workspace_did_change_watched_files(¶ms), Err(notification) => notification, }; - // exit - let notification = match extract::(notification) { - Ok(_params) => return server.exit_notification(), - Err(notification) => notification, - }; if !notification.method.starts_with("$/") { debug!("Unhandled notification: {notification:?}");