diff options
author | tom-anders <13141438+tom-anders@users.noreply.github.com> | 2024-05-04 09:56:18 +0200 |
---|---|---|
committer | tom-anders <13141438+tom-anders@users.noreply.github.com> | 2024-05-07 19:55:09 +0200 |
commit | 3da251efc6329c4d5e6b94780815dce8d6e24999 (patch) | |
tree | 3f242ba8fca18ce0747bebbe9e422a1b25df2b60 /runtime/lua/vim/lsp/handlers.lua | |
parent | 4e5086a67e8916d9a5c5c5cb1933633b3e200eee (diff) | |
download | rneovim-3da251efc6329c4d5e6b94780815dce8d6e24999.tar.gz rneovim-3da251efc6329c4d5e6b94780815dce8d6e24999.tar.bz2 rneovim-3da251efc6329c4d5e6b94780815dce8d6e24999.zip |
refactor(lsp): use vim.is_callable()
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r-- | runtime/lua/vim/lsp/handlers.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 4672d94105..11818b6a89 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -257,7 +257,7 @@ M[ms.textDocument_references] = function(_, result, ctx, config) vim.fn.setloclist(0, {}, ' ', { title = title, items = items, context = ctx }) api.nvim_command('lopen') elseif config.on_list then - assert(type(config.on_list) == 'function', 'on_list is not a function') + assert(vim.is_callable(config.on_list), 'on_list is not a function') config.on_list({ title = title, items = items, context = ctx }) else vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx }) @@ -290,7 +290,7 @@ local function response_to_list(map_result, entity, title_fn) vim.fn.setloclist(0, {}, ' ', { title = title, items = items, context = ctx }) api.nvim_command('lopen') elseif config.on_list then - assert(type(config.on_list) == 'function', 'on_list is not a function') + assert(vim.is_callable(config.on_list), 'on_list is not a function') config.on_list({ title = title, items = items, context = ctx }) else vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx }) @@ -436,7 +436,7 @@ local function location_handler(_, result, ctx, config) local items = util.locations_to_items(result, client.offset_encoding) if config.on_list then - assert(type(config.on_list) == 'function', 'on_list is not a function') + assert(vim.is_callable(config.on_list), 'on_list is not a function') config.on_list({ title = title, items = items }) return end |