aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-09-15 11:35:04 -0700
committerGitHub <noreply@github.com>2021-09-15 11:35:04 -0700
commit685cf398130c61c158401b992a1893c2405cd7d2 (patch)
tree22c2d07339ca49b13c2785a2b80ce86555ccab9c /runtime/lua/vim/lsp.lua
parentafdc9e61502a9f02c8cf5156652a1bde027e4345 (diff)
downloadrneovim-685cf398130c61c158401b992a1893c2405cd7d2.tar.gz
rneovim-685cf398130c61c158401b992a1893c2405cd7d2.tar.bz2
rneovim-685cf398130c61c158401b992a1893c2405cd7d2.zip
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
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r--runtime/lua/vim/lsp.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 0fdd43e210..3276563439 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -674,7 +674,7 @@ function lsp.start_client(config)
---@param method (string) LSP method name
---@param params (table) The parameters for that method.
function dispatch.notification(method, params)
- local _ = log.debug() and log.debug('notification', method, params)
+ local _ = log.trace() and log.trace('notification', method, params)
local handler = resolve_handler(method)
if handler then
-- Method name is provided here for convenience.
@@ -688,13 +688,13 @@ function lsp.start_client(config)
---@param method (string) LSP method name
---@param params (table) The parameters for that method
function dispatch.server_request(method, params)
- local _ = log.debug() and log.debug('server_request', method, params)
+ local _ = log.trace() and log.trace('server_request', method, params)
local handler = resolve_handler(method)
if handler then
- local _ = log.debug() and log.debug("server_request: found handler for", method)
+ local _ = log.trace() and log.trace("server_request: found handler for", method)
return handler(nil, params, {method=method, client_id=client_id})
end
- local _ = log.debug() and log.debug("server_request: no handler found for", method)
+ local _ = log.warn() and log.warn("server_request: no handler found for", method)
return nil, lsp.rpc_response_error(protocol.ErrorCodes.MethodNotFound)
end
@@ -826,7 +826,7 @@ function lsp.start_client(config)
-- TODO(ashkan) handle errors here.
pcall(config.before_init, initialize_params, config)
end
- local _ = log.debug() and log.debug(log_prefix, "initialize_params", initialize_params)
+ local _ = log.trace() and log.trace(log_prefix, "initialize_params", initialize_params)
rpc.request('initialize', initialize_params, function(init_err, result)
assert(not init_err, tostring(init_err))
assert(result, "server sent empty result")