aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua11
1 files changed, 11 insertions, 0 deletions
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