feat: add jump_type option for lsp_references (#2218)
This commit is contained in:
@@ -39,6 +39,20 @@ lsp.references = function(opts)
|
||||
return
|
||||
end
|
||||
|
||||
if #locations == 1 and opts.jump_type ~= "never" then
|
||||
if opts.jump_type == "tab" then
|
||||
vim.cmd "tabedit"
|
||||
elseif opts.jump_type == "split" then
|
||||
vim.cmd "new"
|
||||
elseif opts.jump_type == "vsplit" then
|
||||
vim.cmd "vnew"
|
||||
end
|
||||
-- jump to location
|
||||
vim.api.nvim_win_set_buf(0, opts.bufnr)
|
||||
vim.api.nvim_win_set_cursor(0, { locations[1].lnum, locations[1].col - 1 })
|
||||
return
|
||||
end
|
||||
|
||||
pickers
|
||||
.new(opts, {
|
||||
prompt_title = "LSP References",
|
||||
|
||||
Reference in New Issue
Block a user