mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
fix(lsp): set tagstack on jump via goto methods
Follow up to https://github.com/neovim/neovim/pull/30877 Fixes https://github.com/neovim/neovim/issues/30926
This commit is contained in:

committed by
Mathias Fußenegger

parent
5c44c02405
commit
3c51058d76
@@ -54,6 +54,9 @@ local function get_locations(method, opts)
|
||||
return
|
||||
end
|
||||
local win = api.nvim_get_current_win()
|
||||
local from = vim.fn.getpos('.')
|
||||
from[1] = bufnr
|
||||
local tagname = vim.fn.expand('<cword>')
|
||||
local remaining = #clients
|
||||
|
||||
---@type vim.quickfix.entry[]
|
||||
@@ -89,6 +92,13 @@ local function get_locations(method, opts)
|
||||
if #all_items == 1 then
|
||||
local item = all_items[1]
|
||||
local b = item.bufnr or vim.fn.bufadd(item.filename)
|
||||
|
||||
-- Save position in jumplist
|
||||
vim.cmd("normal! m'")
|
||||
-- Push a new item into tagstack
|
||||
local tagstack = { { tagname = tagname, from = from } }
|
||||
vim.fn.settagstack(vim.fn.win_getid(win), { items = tagstack }, 't')
|
||||
|
||||
vim.bo[b].buflisted = true
|
||||
local w = opts.reuse_win and vim.fn.win_findbuf(b)[1] or win
|
||||
api.nvim_win_set_buf(w, b)
|
||||
|
Reference in New Issue
Block a user