mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
parent
295f98c8e0
commit
9aab98a275
@ -1,7 +1,7 @@
|
|||||||
local uv = vim.uv
|
local uv = vim.uv
|
||||||
local log = require('vim.lsp.log')
|
local log = require('vim.lsp.log')
|
||||||
local protocol = require('vim.lsp.protocol')
|
local protocol = require('vim.lsp.protocol')
|
||||||
local validate, schedule, schedule_wrap = vim.validate, vim.schedule, vim.schedule_wrap
|
local validate, schedule_wrap = vim.validate, vim.schedule_wrap
|
||||||
|
|
||||||
local is_win = vim.fn.has('win32') == 1
|
local is_win = vim.fn.has('win32') == 1
|
||||||
|
|
||||||
@ -409,8 +409,7 @@ function Client:handle_body(body)
|
|||||||
local err --- @type lsp.ResponseError|nil
|
local err --- @type lsp.ResponseError|nil
|
||||||
-- Schedule here so that the users functions don't trigger an error and
|
-- Schedule here so that the users functions don't trigger an error and
|
||||||
-- we can still use the result.
|
-- we can still use the result.
|
||||||
schedule(function()
|
vim.schedule(coroutine.wrap(function()
|
||||||
coroutine.wrap(function()
|
|
||||||
local status, result
|
local status, result
|
||||||
status, result, err = self:try_call(
|
status, result, err = self:try_call(
|
||||||
M.client_errors.SERVER_REQUEST_HANDLER_ERROR,
|
M.client_errors.SERVER_REQUEST_HANDLER_ERROR,
|
||||||
@ -418,10 +417,7 @@ function Client:handle_body(body)
|
|||||||
decoded.method,
|
decoded.method,
|
||||||
decoded.params
|
decoded.params
|
||||||
)
|
)
|
||||||
log.debug(
|
log.debug('server_request: callback result', { status = status, result = result, err = err })
|
||||||
'server_request: callback result',
|
|
||||||
{ status = status, result = result, err = err }
|
|
||||||
)
|
|
||||||
if status then
|
if status then
|
||||||
if result == nil and err == nil then
|
if result == nil and err == nil then
|
||||||
error(
|
error(
|
||||||
@ -450,8 +446,7 @@ function Client:handle_body(body)
|
|||||||
result = nil
|
result = nil
|
||||||
end
|
end
|
||||||
self:send_response(decoded.id, err, result)
|
self:send_response(decoded.id, err, result)
|
||||||
end)()
|
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 ~= vim.NIL or decoded.error ~= vim.NIL) then
|
elseif decoded.id and (decoded.result ~= vim.NIL or decoded.error ~= vim.NIL) then
|
||||||
-- We sent a number, so we expect a number.
|
-- We sent a number, so we expect a number.
|
||||||
|
Loading…
Reference in New Issue
Block a user