diff options
author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-09-15 11:35:04 -0700 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2021-09-26 11:28:28 -0700 |
commit | 7b1315fe61131f787d9351ecd444346b95f5e49c (patch) | |
tree | dcb7355549dcdebdf40b18bbddc3af48cdefcb90 /runtime/lua/vim/lsp.lua | |
parent | 27bac13be66946e2cb2912a44185d18b0f856a32 (diff) | |
download | rneovim-7b1315fe61131f787d9351ecd444346b95f5e49c.tar.gz rneovim-7b1315fe61131f787d9351ecd444346b95f5e49c.tar.bz2 rneovim-7b1315fe61131f787d9351ecd444346b95f5e49c.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.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 6365091668..0c51321d32 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -677,7 +677,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. @@ -691,13 +691,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 @@ -824,7 +824,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") |