Skip to content

Jumping out of nested snippets #1206

@ccatrett

Description

@ccatrett

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions