mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Use err_message in default_callbacks
This commit is contained in:
parent
4c7ef3754a
commit
9b7f956715
@ -20,18 +20,23 @@ M['textDocument/publishDiagnostics'] = function(_, _, result)
|
|||||||
-- util.buf_loclist(bufnr, result.diagnostics)
|
-- util.buf_loclist(bufnr, result.diagnostics)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function err_message(...)
|
||||||
|
api.nvim_err_writeln(table.concat(vim.tbl_flatten{...}))
|
||||||
|
api.nvim_command("redraw")
|
||||||
|
end
|
||||||
|
|
||||||
local function log_message(_, _, result, client_id)
|
local function log_message(_, _, result, client_id)
|
||||||
local message_type = result.type
|
local message_type = result.type
|
||||||
local message = result.message
|
local message = result.message
|
||||||
local client = vim.lsp.get_client_by_id(client_id)
|
local client = vim.lsp.get_client_by_id(client_id)
|
||||||
local client_name = client and client.name or string.format("id=%d", client_id)
|
local client_name = client and client.name or string.format("id=%d", client_id)
|
||||||
if not client then
|
if not client then
|
||||||
api.nvim_err_writeln(string.format("LSP[%s] client has shut down after sending the message", client_name))
|
err_message("LSP[", client_name, "] client has shut down after sending the message")
|
||||||
end
|
end
|
||||||
if message_type == protocol.MessageType.Error then
|
if message_type == protocol.MessageType.Error then
|
||||||
-- Might want to not use err_writeln,
|
-- Might want to not use err_writeln,
|
||||||
-- but displaying a message with red highlights or something
|
-- but displaying a message with red highlights or something
|
||||||
api.nvim_err_writeln(string.format("LSP[%s] %s", client_name, message))
|
err_message("LSP[", client_name, "] ", message)
|
||||||
else
|
else
|
||||||
local message_type_name = protocol.MessageType[message_type]
|
local message_type_name = protocol.MessageType[message_type]
|
||||||
api.nvim_out_write(string.format("LSP[%s][%s] %s\n", client_name, message_type_name, message))
|
api.nvim_out_write(string.format("LSP[%s][%s] %s\n", client_name, message_type_name, message))
|
||||||
|
Loading…
Reference in New Issue
Block a user