fix: set tagstack when we jump with lsp in telescope (#1887)

Co-authored-by: Simon Hauser <Simon-Hauser@outlook.de>
This commit is contained in:
dagle
2022-05-18 19:59:12 +02:00
committed by GitHub
parent 01fc5a9274
commit 3cc44f8f05
4 changed files with 16 additions and 3 deletions

View File

@@ -133,14 +133,21 @@ action_set.edit = function(prompt_bufnr, command)
local picker = action_state.get_current_picker(prompt_bufnr)
require("telescope.actions").close(prompt_bufnr)
local win_id = picker.get_selection_window(picker, entry)
if win_id ~= 0 and a.nvim_get_current_win() ~= win_id then
vim.api.nvim_set_current_win(win_id)
end
if picker.push_cursor_on_edit then
vim.cmd "normal! m'"
end
if picker.push_tagstack_on_edit then
local from = { vim.fn.bufnr "%", vim.fn.line ".", vim.fn.col ".", 0 }
local items = { { tagname = vim.fn.expand "<cword>", from = from } }
vim.fn.settagstack(vim.fn.win_getid(), { items = items }, "t")
end
if win_id ~= 0 and a.nvim_get_current_win() ~= win_id then
vim.api.nvim_set_current_win(win_id)
end
if entry_bufnr then
if not vim.api.nvim_buf_get_option(entry_bufnr, "buflisted") then
vim.api.nvim_buf_set_option(entry_bufnr, "buflisted", true)