diff options
| author | Gutyina Gergő <gutyina.gergo.2@gmail.com> | 2022-11-06 17:43:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-06 17:43:01 +0100 |
| commit | cc77713294892c5bbce26adee665114250624e6b (patch) | |
| tree | df11066dbd790d588692fb066d1d6be0ef2c868d /lua/telescope/builtin/__lsp.lua | |
| parent | d541e0d6e00a0d89f21e1b0e6fe92c736ac0f83b (diff) | |
feat: add jump_type option for lsp_references (#2218)
Diffstat (limited to 'lua/telescope/builtin/__lsp.lua')
| -rw-r--r-- | lua/telescope/builtin/__lsp.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lua/telescope/builtin/__lsp.lua b/lua/telescope/builtin/__lsp.lua index 21aa8ed..ab2cd7d 100644 --- a/lua/telescope/builtin/__lsp.lua +++ b/lua/telescope/builtin/__lsp.lua @@ -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", |
