-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
[Feature Request] Get Position of Destination if Jumpable #676
Comments
Hi! |
Thank you! It will be even better if we can get the destination position of a back jump ( |
Hello! I would like know if LuaSnip is going to implement the feature in the foreseeable future? Thanks! 😄 |
I have some time today, I'll look into it :) |
Thank you! I've looked through the code base several times trying to figure out how LuaSnip moves the cursor to the right position. I did find some |
It's pretty hard to get into the "core-logic", especially because there are sooooo many functions in each node 😅 I'll have to write some documentation on what each does sometime Anyways, I did a PR, which should work (would be cool if you could check it out and see if everything is going smoothly, I did not test it completely yet 😅): #740 |
I'm testing this out and it works pretty well so far. The return value of |
Ha, yeah informative is putting it lightly xD Can you find all the data you need? |
No.. I haven't found out yet. I'm trying to find the absolute/relative position (either 0-indexed or 1-indexed) of the next node. Ideally the location data should be like the parameters passing to I'm looking into the field |
Oh, I added that too in the PR, take a look at the second commit. |
Thank you so much! My bad, I didn't realize that I can use Now I'm able to get the destination with: local next_node = luasnip.jump_destination(1)
local pos = next_node:get_buf_position() |
Hi! I've tested the APIs these few days and I find that in some cases simplescreenrecorder-2023-01-25_19.54.18.mp4You can see my mapping for |
Oooh, I think the issue is that not changing any state may lead to this endless loop. Could you share the snippet? |
nvm, I found the error :D |
Thanks, it now works flawlessly! |
First of all thank you for this awesome plugin! It is fast and super powerful, but there's one thing that I'm struggling with to get a smoother experience -- I use a custom function to use
<Tab>
to jump out of parenthesis and brackets, but I always mess it up with luasnip's jump functionality.So I want to ask if it is possible to get the destination position of a luasnip jump? If so I can get the destination position of the jump from luasnip then I can compare the destination of the jump performed by luasnip and that of the jump of my custom function then always choose the one with the smaller cursor displacement.
The text was updated successfully, but these errors were encountered: