def: fix the stack commands when the native tag stack is used - #3754
Merged
Merged
Conversation
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>
Collaborator
|
Thank you for contributing. I'll try to prioritize taking a close look soon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.