mirror of
https://github.com/neovim/neovim.git
synced 2025-10-25 20:07:09 +00:00
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
)
This commit is contained in:
@@ -518,7 +518,7 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
|
|||||||
send_response(decoded.id, err, result)
|
send_response(decoded.id, err, result)
|
||||||
end)
|
end)
|
||||||
-- This works because we are expecting vim.NIL here
|
-- 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
|
-- Server Result
|
||||||
decoded.error = convert_NIL(decoded.error)
|
decoded.error = convert_NIL(decoded.error)
|
||||||
decoded.result = convert_NIL(decoded.result)
|
decoded.result = convert_NIL(decoded.result)
|
||||||
|
|||||||
Reference in New Issue
Block a user