Skip to content
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

Jumping out of nested snippets #1206

Open
ccatrett opened this issue Jul 6, 2024 · 1 comment
Open

Jumping out of nested snippets #1206

ccatrett opened this issue Jul 6, 2024 · 1 comment

Comments

@ccatrett
Copy link

ccatrett commented Jul 6, 2024

Hi, new nvim user trying to figure out how to use luasnips!

I have the following issue when trying to jump out of nested/iterated snippets with a minimal example:

s('_', {
    t('_{ '), i(1), t(' }')
})

which expands an underscore character to an underscore with curly braces.

Expected Behavior

After expanding more than once in a nested snippet, I want to be able to jump all the way back out, so for example,

_*   -->   _{ * }    -->   _{  _{ * } }   -->   _{  _{ ustext }* }   -->   _{ _{ text } }*

where * represents my cursor position, and the arrows indicate a jump or expansion.

Actual Behavior
After expanding more than once, my cursor gets stuck between the two closing curly braces:

_*   -->   _{ * }    -->   _{  _{ * } }   -->   _{  _{ text }* }   -->   _{ _{ text }* }    -->   _{ _{ text }* } 

no matter how many times I expand or jump.

The steps to reproduce would simply be to recreate this minimal example.

I thought that #1070 may be similar, but I couldn't figure out what the intended solution with the conditions approach was.

Is this intended behavior? How can I mitigate this so that I can achieve the expected behavior?

@L3MON4D3
Copy link
Owner

Hi! :)
Usually you should be able to jump out of the first snippet as well... at least this is working on my end.
What version of luasnip are you using? Could you check the log for suspicious entries?
Do ls.log.set_loglevel("info") before expanding the snippets, and check the log with ls.log.open() (ls being require("luasnip"))

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

No branches or pull requests

2 participants