diff options
author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-02-26 02:41:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-26 02:41:29 -0800 |
commit | c1fbc2ddf15b2f44b615f90b2511349ab974cb83 (patch) | |
tree | 4afdd57f0a02be8268d5dea939207f76d33c57be | |
parent | 0c7610cf9dd6aa190676fb2ecc8e6cce34f80962 (diff) | |
parent | 365c353c9a771feedf7fced1bc337066cd78f5d6 (diff) | |
download | rneovim-c1fbc2ddf15b2f44b615f90b2511349ab974cb83.tar.gz rneovim-c1fbc2ddf15b2f44b615f90b2511349ab974cb83.tar.bz2 rneovim-c1fbc2ddf15b2f44b615f90b2511349ab974cb83.zip |
Merge pull request #14022 from crispgm/lsp-start-error
lsp: prompt correct error when language server start fails
-rw-r--r-- | runtime/lua/vim/lsp/rpc.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index 90f51dfc5a..4e2dd7c8e8 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -376,6 +376,9 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params) spawn_params.env = env_merge(extra_spawn_params.env) end handle, pid = uv.spawn(cmd, spawn_params, onexit) + if handle == nil then + error(string.format("start `%s` failed: %s", cmd, pid)) + end end --@private @@ -386,7 +389,7 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params) --@returns true if the payload could be scheduled, false if the main event-loop is in the process of closing. local function encode_and_send(payload) local _ = log.debug() and log.debug("rpc.send.payload", payload) - if handle:is_closing() then return false end + if handle == nil or handle:is_closing() then return false end -- TODO(ashkan) remove this once we have a Lua json_encode schedule(function() local encoded = assert(json_encode(payload)) |