diff options
author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-04-23 12:49:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-23 12:49:40 -0700 |
commit | d650c654a8aee99e925e3fccc6d2d42598482beb (patch) | |
tree | 3c0c66cee2c4aec4cefc47d81086d923d6fd233d /runtime/lua/vim/lsp.lua | |
parent | be494023d89772b5b504b13dc21a5240519b1f3a (diff) | |
parent | 4eb29e079ac12b250f80e2716e1aa1afdcdd505f (diff) | |
download | rneovim-d650c654a8aee99e925e3fccc6d2d42598482beb.tar.gz rneovim-d650c654a8aee99e925e3fccc6d2d42598482beb.tar.bz2 rneovim-d650c654a8aee99e925e3fccc6d2d42598482beb.zip |
Merge pull request #14432 from mjlbach/revert_14428
Revert "lsp: fix blocking in closing of clients"
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r-- | runtime/lua/vim/lsp.lua | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index d45827b0d7..cb3d4bbe9f 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1179,38 +1179,11 @@ function lsp._vim_exit_handler() client.stop() end - local function wait_async(timeout, ms, predicate, cb) - local timer = uv.new_timer() - local time = 0 - - local function done(in_time) - timer:stop() - timer:close() - cb(in_time) + if not vim.wait(500, function() return tbl_isempty(active_clients) end, 50) then + for _, client in pairs(active_clients) do + client.stop(true) end - - timer:start(0, ms, function() - if predicate() == true then - done(true) - return - end - - if time == timeout then - done(false) - return - end - - time = time + ms - end) end - - wait_async(500, 50, function() return tbl_isempty(active_clients) end, function(in_time) - if not in_time then - for _, client in pairs(active_clients) do - client.stop(true) - end - end - end) end nvim_command("autocmd VimLeavePre * lua vim.lsp._vim_exit_handler()") |