Skip to content

def: fix the stack commands when the native tag stack is used - #3754

Merged
bhcleek merged 1 commit into
fatih:masterfrom
kevinburke:fix-godef-stack-native-tagstack
Aug 23, 2026
Merged

bhcleek merged 1 commit into
fatih:masterfrom
kevinburke:fix-godef-stack-native-tagstack

Conversation

@kevinburke

Copy link
Copy Markdown
Contributor

vim-go records the location that a jump to a definition was made from on Vim's native tag stack when settagstack() supports the 't' action, but :GoDefPop, :GoDefStack, and :GoDefStackClear kept reading the script local stack that is only written to on older versions. All three have been inert on any Vim with patch-8.2.0077 and on Neovim; :GoDefPop and :GoDefStack always reported 'godef stack empty'.

Read whichever stack is in use instead. Each native tag stack item records the position that the jump was made from in its 'from' field, which is exactly what vim-go's own stack entries hold, so the commands can keep their documented behavior. Jumping to a newer entry sets curidx and moves the cursor directly rather than using :tag, because :tag re-runs a real tag lookup and fails without a tags file.

CTRL-t is unaffected: ftplugin/go.vim already leaves it alone when the native tag stack is used so that Vim's builtin CTRL-t pops it.

vim-go records the location that a jump to a definition was made from on
Vim's native tag stack when settagstack() supports the 't' action, but
:GoDefPop, :GoDefStack, and :GoDefStackClear kept reading the script
local stack that is only written to on older versions. All three have
been inert on any Vim with patch-8.2.0077 and on Neovim; :GoDefPop and
:GoDefStack always reported 'godef stack empty'.

Read whichever stack is in use instead. Each native tag stack item
records the position that the jump was made from in its 'from' field,
which is exactly what vim-go's own stack entries hold, so the commands
can keep their documented behavior. Jumping to a newer entry sets curidx
and moves the cursor directly rather than using :tag, because :tag
re-runs a real tag lookup and fails without a tags file.

CTRL-t is unaffected: ftplugin/go.vim already leaves it alone when the
native tag stack is used so that Vim's builtin CTRL-t pops it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bhcleek

bhcleek commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Thank you for contributing. I'll try to prioritize taking a close look soon.

@bhcleek
bhcleek merged commit 4769497 into fatih:master Aug 23, 2026
8 checks passed
@bhcleek bhcleek added this to the vim-go v1.30 milestone Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants