From 001dd498894e4c554e92af507fb27739146c177d Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 2 Mar 2024 00:54:44 +0900 Subject: [PATCH] fix(lsp): schedule api calls in `on_exit` (#267) --- lua/rustaceanvim/lsp.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/rustaceanvim/lsp.lua b/lua/rustaceanvim/lsp.lua index 177cc73d..5835ad32 100644 --- a/lua/rustaceanvim/lsp.lua +++ b/lua/rustaceanvim/lsp.lua @@ -178,8 +178,11 @@ M.start = function(bufnr) local old_on_exit = lsp_start_config.on_exit lsp_start_config.on_exit = function(...) override_apply_text_edits() - commands.delete_rust_lsp_command() - vim.api.nvim_del_augroup_by_id(augroup) + -- on_exit runs in_fast_event + vim.schedule(function() + commands.delete_rust_lsp_command() + vim.api.nvim_del_augroup_by_id(augroup) + end) if type(old_on_exit) == 'function' then old_on_exit(...) end