Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit 84aab99

Browse files
authored
fix: rename callbacks to handlers (#268)
1 parent 3b6774e commit 84aab99

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lua/completion/hover.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ local fancy_floating_markdown = function(contents, opts)
246246
return bufnr, winnr
247247
end
248248

249-
local callback = 'textDocument/hover'
250-
M.default_callback = vim.lsp.callbacks[callback]
249+
local handler = 'textDocument/hover'
250+
M.default_handler = vim.lsp.handlers[handler]
251251

252-
local function callback_function(_, method, result)
252+
local function handler_function(_, method, result)
253253
-- if M.winnr ~= nil and api.nvim_win_is_valid(M.winnr) then
254254
-- api.nvim_win_close(M.winnr, true)
255255
-- end
@@ -297,16 +297,16 @@ local function callback_function(_, method, result)
297297
return bufnr, winnr
298298
end)
299299
else
300-
M.default_callback(_, method, result, _)
300+
M.default_handler(_, method, result, _)
301301
end
302302
end
303303

304304
M.autoOpenHoverInPopup = function()
305305
if vim.fn.pumvisible() ~= 1 then return end
306306
for _, client in pairs(vim.lsp.buf_get_clients(0)) do
307-
local default_callback = client.config.callbacks['textDocument/hover'] or vim.lsp.callbacks['textDocument/hover']
308-
if default_callback ~= callback_function then
309-
client.config.callbacks['textDocument/hover'] = callback_function
307+
local default_handler = (client.config.handlers or {})['textDocument/hover'] or vim.lsp.handlers['textDocument/hover']
308+
if default_handler ~= handler_function then
309+
client.config.handlers['textDocument/hover'] = handler_function
310310
end
311311
end
312312

lua/completion/signature_help.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ M.autoOpenSignatureHelp = function()
3030
local params = vim.lsp.util.make_position_params()
3131
vim.lsp.buf_request(0, 'textDocument/signatureHelp', params, function(err, method, result, client_id)
3232
local client = vim.lsp.get_client_by_id(client_id)
33-
local callback = client and client.callbacks['textDocument/signatureHelp']
34-
if callback then
35-
callback(err, method, result, client_id)
33+
local handler = client and client.handler['textDocument/signatureHelp']
34+
if handler then
35+
handler(err, method, result, client_id)
3636
return
3737
end
3838
if not (result and result.signatures and result.signatures[1]) then

0 commit comments

Comments
 (0)