From 62e6a847a85e25037a4a7fbcd4af697928d5ecfc Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 25 Oct 2024 14:23:57 +0200 Subject: attempt a gracefully shutdown the language servers when vis quits --- init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init.lua b/init.lua index 801573d..15d03b5 100644 --- a/init.lua +++ b/init.lua @@ -1745,6 +1745,17 @@ vis.events.subscribe(lspc.events.LS_INITIALIZED, function(ls) end end) +vis.events.subscribe(vis.events.QUIT, function() + for _, ls in pairs(lspc.running) do + -- attempt to gracefully shutdown the language server + ls:shutdown() + -- close the fd handle to terminate the subprocess because + -- a potential method response from the server will not be read after the + -- QUIT event + ls.fd:close() + end +end) + vis:option_register('lspc-highlight-diagnostics', 'string', function(value) lspc.highlight_diagnostics = value return true -- cgit v1.2.3