diff options
author | Mathias Fussenegger <f.mathias@zignar.net> | 2021-04-30 20:04:13 +0200 |
---|---|---|
committer | Mathias Fussenegger <f.mathias@zignar.net> | 2021-04-30 20:17:56 +0200 |
commit | 69d4143e7baab15bb02ad8e4b48511a41cfdcd95 (patch) | |
tree | fdbf26a589abf55abf7c57c3aea9f7f629dbd07c /runtime/lua/vim/lsp/rpc.lua | |
parent | 388a834a07e07509c44a5c257dc397b331b0cb39 (diff) | |
download | rneovim-69d4143e7baab15bb02ad8e4b48511a41cfdcd95.tar.gz rneovim-69d4143e7baab15bb02ad8e4b48511a41cfdcd95.tar.bz2 rneovim-69d4143e7baab15bb02ad8e4b48511a41cfdcd95.zip |
lsp: Allow decoded.result to be `false`
Some servers might respond to `workspace/executeCommand` requests with a
boolean result and that could be `false`.
A `false` result should be allowed and not trigger the `on_error`
handler:
-- Invalid server message
on_error(client_errors.INVALID_SERVER_MESSAGE, decoded)
Concrete example where this occurred is with eclipse.jdt.ls:
vim.lsp.buf_request(
0,
'workspace/executeCommand',
{
command = 'java.project.isTestFile',
arguments = { vim.uri_from_bufnr(0), },
},
function(err, _, resp)
print(vim.inspect(err), vim.inspect(resp))
end
)
Diffstat (limited to 'runtime/lua/vim/lsp/rpc.lua')
-rw-r--r-- | runtime/lua/vim/lsp/rpc.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua index 1aa8326514..0cabd1a0d4 100644 --- a/runtime/lua/vim/lsp/rpc.lua +++ b/runtime/lua/vim/lsp/rpc.lua @@ -518,7 +518,7 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params) send_response(decoded.id, err, result) end) -- This works because we are expecting vim.NIL here - elseif decoded.id and (decoded.result or decoded.error) then + elseif decoded.id and (decoded.result ~= vim.NIL or decoded.error ~= vim.NIL) then -- Server Result decoded.error = convert_NIL(decoded.error) decoded.result = convert_NIL(decoded.result) |