mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
feat(lsp): improve logging (#15636)
* Simplify rpc encode/decode messages to rpc.send/rcp.receive * Make missing handlers message throw a warning * Clean up formatting style in log * Move all non-RPC loop messages to trace instead of debug * Add format func option to log to allow newlines in per log entry
This commit is contained in:

committed by
Justin M. Keyes

parent
27bac13be6
commit
7b1315fe61
@@ -419,7 +419,7 @@ M['window/logMessage'] = function(_, result, ctx, _)
|
||||
log.error(message)
|
||||
elseif message_type == protocol.MessageType.Warning then
|
||||
log.warn(message)
|
||||
elseif message_type == protocol.MessageType.Info then
|
||||
elseif message_type == protocol.MessageType.Info or message_type == protocol.MessageType.Log then
|
||||
log.info(message)
|
||||
else
|
||||
log.debug(message)
|
||||
@@ -449,7 +449,7 @@ end
|
||||
-- Add boilerplate error validation and logging for all of these.
|
||||
for k, fn in pairs(M) do
|
||||
M[k] = function(err, result, ctx, config)
|
||||
local _ = log.debug() and log.debug('default_handler', ctx.method, {
|
||||
local _ = log.trace() and log.trace('default_handler', ctx.method, {
|
||||
err = err, result = result, ctx=vim.inspect(ctx), config = config
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user