mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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
This commit is contained in:
parent
cdc0974063
commit
80d108eeee
@ -256,13 +256,13 @@ M[ms.textDocument_references] = function(_, result, ctx, config)
|
|||||||
local list = { title = title, items = items, context = ctx }
|
local list = { title = title, items = items, context = ctx }
|
||||||
if config.loclist then
|
if config.loclist then
|
||||||
vim.fn.setloclist(0, {}, ' ', list)
|
vim.fn.setloclist(0, {}, ' ', list)
|
||||||
api.nvim_command('lopen')
|
vim.cmd.lopen()
|
||||||
elseif config.on_list then
|
elseif config.on_list then
|
||||||
assert(vim.is_callable(config.on_list), 'on_list is not a function')
|
assert(vim.is_callable(config.on_list), 'on_list is not a function')
|
||||||
config.on_list(list)
|
config.on_list(list)
|
||||||
else
|
else
|
||||||
vim.fn.setqflist({}, ' ', list)
|
vim.fn.setqflist({}, ' ', list)
|
||||||
api.nvim_command('botright copen')
|
vim.cmd('botright copen')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -290,13 +290,13 @@ local function response_to_list(map_result, entity, title_fn)
|
|||||||
local list = { title = title, items = items, context = ctx }
|
local list = { title = title, items = items, context = ctx }
|
||||||
if config.loclist then
|
if config.loclist then
|
||||||
vim.fn.setloclist(0, {}, ' ', list)
|
vim.fn.setloclist(0, {}, ' ', list)
|
||||||
api.nvim_command('lopen')
|
vim.cmd.lopen()
|
||||||
elseif config.on_list then
|
elseif config.on_list then
|
||||||
assert(vim.is_callable(config.on_list), 'on_list is not a function')
|
assert(vim.is_callable(config.on_list), 'on_list is not a function')
|
||||||
config.on_list(list)
|
config.on_list(list)
|
||||||
else
|
else
|
||||||
vim.fn.setqflist({}, ' ', list)
|
vim.fn.setqflist({}, ' ', list)
|
||||||
api.nvim_command('botright copen')
|
vim.cmd('botright copen')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -447,7 +447,7 @@ local function location_handler(_, result, ctx, config)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
vim.fn.setqflist({}, ' ', { title = title, items = items })
|
vim.fn.setqflist({}, ' ', { title = title, items = items })
|
||||||
api.nvim_command('botright copen')
|
vim.cmd('botright copen')
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_declaration
|
--- @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
|
||||||
end
|
end
|
||||||
vim.fn.setqflist({}, ' ', { title = 'LSP call hierarchy', items = items })
|
vim.fn.setqflist({}, ' ', { title = 'LSP call hierarchy', items = items })
|
||||||
api.nvim_command('botright copen')
|
vim.cmd('botright copen')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -596,7 +596,7 @@ local function make_type_hierarchy_handler()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
vim.fn.setqflist({}, ' ', { title = 'LSP type hierarchy', items = items })
|
vim.fn.setqflist({}, ' ', { title = 'LSP type hierarchy', items = items })
|
||||||
api.nvim_command('botright copen')
|
vim.cmd('botright copen')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user