aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/handlers.lua
diff options
context:
space:
mode:
authortom-anders <13141438+tom-anders@users.noreply.github.com>2024-05-04 10:04:47 +0200
committertom-anders <13141438+tom-anders@users.noreply.github.com>2024-05-07 21:27:18 +0200
commit80d108eeee89c095e0c1226a558a690a708abaa1 (patch)
treea2733ab525861f3c2d2708b2083027c4350b191f /runtime/lua/vim/lsp/handlers.lua
parentcdc0974063fd18199040e783df5826af5786aee3 (diff)
downloadrneovim-80d108eeee89c095e0c1226a558a690a708abaa1.tar.gz
rneovim-80d108eeee89c095e0c1226a558a690a708abaa1.tar.bz2
rneovim-80d108eeee89c095e0c1226a558a690a708abaa1.zip
refactor(lsp): use vim.cmd instead of api.nvim_command
As suggested in https://github.com/neovim/neovim/pull/28483#discussion_r1586878457 and https://github.com/neovim/neovim/pull/28483#discussion_r1586878226
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r--runtime/lua/vim/lsp/handlers.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index aff98dc5cb..c639a317cf 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -256,13 +256,13 @@ M[ms.textDocument_references] = function(_, result, ctx, config)
local list = { title = title, items = items, context = ctx }
if config.loclist then
vim.fn.setloclist(0, {}, ' ', list)
- api.nvim_command('lopen')
+ vim.cmd.lopen()
elseif config.on_list then
assert(vim.is_callable(config.on_list), 'on_list is not a function')
config.on_list(list)
else
vim.fn.setqflist({}, ' ', list)
- api.nvim_command('botright copen')
+ vim.cmd('botright copen')
end
end
@@ -290,13 +290,13 @@ local function response_to_list(map_result, entity, title_fn)
local list = { title = title, items = items, context = ctx }
if config.loclist then
vim.fn.setloclist(0, {}, ' ', list)
- api.nvim_command('lopen')
+ vim.cmd.lopen()
elseif config.on_list then
assert(vim.is_callable(config.on_list), 'on_list is not a function')
config.on_list(list)
else
vim.fn.setqflist({}, ' ', list)
- api.nvim_command('botright copen')
+ vim.cmd('botright copen')
end
end
end
@@ -447,7 +447,7 @@ local function location_handler(_, result, ctx, config)
return
end
vim.fn.setqflist({}, ' ', { title = title, items = items })
- api.nvim_command('botright copen')
+ vim.cmd('botright copen')
end
--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_declaration
@@ -557,7 +557,7 @@ local function make_call_hierarchy_handler(direction)
end
end
vim.fn.setqflist({}, ' ', { title = 'LSP call hierarchy', items = items })
- api.nvim_command('botright copen')
+ vim.cmd('botright copen')
end
end
@@ -596,7 +596,7 @@ local function make_type_hierarchy_handler()
})
end
vim.fn.setqflist({}, ' ', { title = 'LSP type hierarchy', items = items })
- api.nvim_command('botright copen')
+ vim.cmd('botright copen')
end
end