fix(lsp): Include client name in handler error messages (#15227)
Makes it easier to tell with language server caused an error.
This commit is contained in:
parent
5f01714b25
commit
24f2b9ef1c
|
@ -457,12 +457,14 @@ for k, fn in pairs(M) do
|
||||||
})
|
})
|
||||||
|
|
||||||
if err then
|
if err then
|
||||||
|
local client = vim.lsp.get_client_by_id(client_id)
|
||||||
|
local client_name = client and client.name or string.format("client_id=%d", client_id)
|
||||||
-- LSP spec:
|
-- LSP spec:
|
||||||
-- interface ResponseError:
|
-- interface ResponseError:
|
||||||
-- code: integer;
|
-- code: integer;
|
||||||
-- message: string;
|
-- message: string;
|
||||||
-- data?: string | number | boolean | array | object | null;
|
-- data?: string | number | boolean | array | object | null;
|
||||||
return err_message(tostring(err.code) .. ': ' .. err.message)
|
return err_message(client_name .. ': ' .. tostring(err.code) .. ': ' .. err.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
return fn(err, method, params, client_id, bufnr, config)
|
return fn(err, method, params, client_id, bufnr, config)
|
||||||
|
|
Loading…
Reference in New Issue