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:
@@ -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)
|
||||
|
||||
@@ -1042,6 +1042,7 @@ internal.marks = function(opts)
|
||||
previewer = conf.grep_previewer(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
push_cursor_on_edit = true,
|
||||
push_tagstack_on_edit = true,
|
||||
}):find()
|
||||
end
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ lsp.references = function(opts)
|
||||
previewer = conf.qflist_previewer(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
push_cursor_on_edit = true,
|
||||
push_tagstack_on_edit = true,
|
||||
}):find()
|
||||
end)
|
||||
end
|
||||
@@ -93,6 +94,8 @@ local function list_or_jump(action, title, opts)
|
||||
},
|
||||
previewer = conf.qflist_previewer(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
push_cursor_on_edit = true,
|
||||
push_tagstack_on_edit = true,
|
||||
}):find()
|
||||
end
|
||||
end)
|
||||
@@ -154,6 +157,7 @@ lsp.document_symbols = function(opts)
|
||||
sorter = conf.generic_sorter(opts),
|
||||
},
|
||||
push_cursor_on_edit = true,
|
||||
push_tagstack_on_edit = true,
|
||||
}):find()
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -117,6 +117,7 @@ function Picker:new(opts)
|
||||
selection_strategy = get_default(opts.selection_strategy, config.values.selection_strategy),
|
||||
|
||||
push_cursor_on_edit = get_default(opts.push_cursor_on_edit, false),
|
||||
push_tagstack_on_edit = get_default(opts.push_tagstack_on_edit, false),
|
||||
|
||||
layout_strategy = layout_strategy,
|
||||
layout_config = config.smarter_depth_2_extend(opts.layout_config or {}, config.values.layout_config or {}),
|
||||
|
||||
Reference in New Issue
Block a user