aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-04-15 04:33:09 -0700
committerGitHub <noreply@github.com>2024-04-15 04:33:09 -0700
commit57adf8c6e01d9395eb52fe03571c535571efdc4b (patch)
treef5f999287509f2970c4f9034934fbecdfadb83ca /runtime/lua/vim/lsp
parent4ec8fd43bfdf1924ee03e07afc8a46dfdd3c9b12 (diff)
downloadrneovim-57adf8c6e01d9395eb52fe03571c535571efdc4b.tar.gz
rneovim-57adf8c6e01d9395eb52fe03571c535571efdc4b.tar.bz2
rneovim-57adf8c6e01d9395eb52fe03571c535571efdc4b.zip
fix(vim.ui): open() may wait indefinitely #28325
Problem: vim.ui.open "locks up" Nvim if the spawned process does not terminate. #27986 Solution: - Change `vim.ui.open()`: - Do not call `wait()`. - Return a `SystemObj`. The caller can decide if it wants to `wait()`. - Change `gx` to `wait()` only a short time. - Allows `gx` to show a message if the command fails, without the risk of waiting forever.
Diffstat (limited to 'runtime/lua/vim/lsp')
-rw-r--r--runtime/lua/vim/lsp/handlers.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index daf4fec8d2..1c5291e7fd 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -615,7 +615,8 @@ M[ms.window_showDocument] = function(_, result, ctx, _)
if result.external then
-- TODO(lvimuser): ask the user for confirmation
- local ret, err = vim.ui.open(uri)
+ local cmd, err = vim.ui.open(uri)
+ local ret = cmd and cmd:wait(2000) or nil
if ret == nil or ret.code ~= 0 then
return {