-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update the tag stack for jump to definition #1218
base: dev
Are you sure you want to change the base?
Conversation
The `a` operation appends to the tag stack, the `t` operation clears everything from the current position to the top of the stack and then appends new entries. We want the latter behavior.
This matches the style of other vim.rs functions.
I'm a little confused, I was expecting this to enable both |
@martskins I noticed that as well. I'm not sure why Edit: one would think |
Ok, I think I know what's happening. Effectively, this is a limitation (or bug) in the way the tag stack is implemented in vim. When the The tag stack contains the name of a tag and where we jumped from to get to that tag, but it doesn't contain the location of the tag, only the tag name. So it seems the only way to actually jump to the next tag on the tag stack would be to locate that tag again. In the case of |
The tagstack does contain the buf number and the position though, I would have expect it to use that to jump to the next tag. I'll try poking around some other implementations of this to see how they behave, I think |
No, it doesn't. It only contains that info for where we jumped from (which could be anywhere). It stores the bufnum, matchnum, and tagname of the current tag, which is enough to look it up from the tags file, but there is no tags file if settagstack was used. That's how vim works at least (not sure about nvim). |
Ooh ok, I misunderstood that part, yeah, I see now. Thanks for clarifying. |
#917 was a previous try at this - with much the same defects. There's some relevant discussion in that MR. |
When jumping to a definition, updating the tag stack would be a useful feature. This allows navigating between definitions independently of other code navigation (
ctrl-o
/ctrl-i
based jumping). Popping the stack is done usingctrl-t
and works the same as jumping works with a tags file generated by ctags. The logic follows this example.Closes #517.
Considerations
gettagstack
andsettagstack
functions before attempting to use them? They are recent additions to vim.