From 4d3c680a9396845f80404fc280a2de026c94f34a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 21 May 2024 12:10:31 +0800 Subject: [PATCH] fix(lsp): set server_ready to false on LspDetach --- lua/spacevim/lsp.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/spacevim/lsp.lua b/lua/spacevim/lsp.lua index 38b10a8c6..b390c809c 100644 --- a/lua/spacevim/lsp.lua +++ b/lua/spacevim/lsp.lua @@ -23,6 +23,12 @@ function M.setup(enabled_clients, override_client_cmds) -- {{{ vim.api.nvim_buf_set_var(args.buf, 'lsp_server_ready', true) end, }) + vim.api.nvim_create_autocmd('LspDetach', { + group = augroup, + callback = function(args) + vim.api.nvim_buf_set_var(args.buf, 'lsp_server_ready', false) + end, + }) -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer