From df17d7844ed7dedcb80f9405f7078a046a12524a Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Sat, 28 Aug 2021 00:12:30 -0400 Subject: feat(lsp)!: change handler signature Previously, the handler signature was: function(err, method, params, client_id, bufnr, config) In order to better support external plugins that wish to extend the protocol, there is other information which would be advantageous to forward to the client, such as the original params of the request that generated the callback. In order to do this, we would need to break symmetry of the handlers, to add an additional "params" as the 7th argument. Instead, this PR changes the signature of the handlers to: function(err, result, ctx, config) where ctx (the context) includes params, client_id, and bufnr. This also leaves flexibility for future use-cases. BREAKING_CHANGE: changes the signature of the built-in client handlers, requiring updating handler calls --- runtime/lua/vim/lsp/buf.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/lsp/buf.lua') diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 250af0a0a7..264d7c0247 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -433,7 +433,7 @@ local function code_action_request(params) for _, r in pairs(results) do vim.list_extend(actions, r.result or {}) end - vim.lsp.handlers[method](nil, method, actions, nil, bufnr) + vim.lsp.handlers[method](nil, actions, {bufnr=bufnr, method=method}) end) end -- cgit