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

$0 behaves differently depending on its content #1217

Open
ofseed opened this issue Jul 31, 2024 · 1 comment
Open

$0 behaves differently depending on its content #1217

ofseed opened this issue Jul 31, 2024 · 1 comment

Comments

@ofseed
Copy link

ofseed commented Jul 31, 2024

All snippets are provided in the vscode format

The following snippet makes the last node of the snippet where the $0 is.

${1:var} = $0;

The following do the same, after jumping to $0, luasnip.jump(1) will no longer take effect, nvim will keep select mode no matter how luasnip.jump(1) is called.

${1:var} = ${0:nil};

The problem occurs in the following snippet. Ideally, it should behave all the same as the last one, i.e. after jumping to $0, luasnip.jump(1) should not take effect, but the actual situation is different, the calling luasnip.jump(1) again will move the cursor to the position before semicolon and enter insert mode.

${1:var} = ${0:$TM_FILENAME_BASE};

I've tested the same cases in vscode, luasnip behaves differently with vscode.

@L3MON4D3
Copy link
Owner

L3MON4D3 commented Aug 1, 2024

Hey :)

IIRC I implemented this because there were some issues with the $0-node in luasnip, in that it couldn't actually contain text.
Since then there have been quite a few changes, and I'll reevaluate whether this still makes sense :)
(But it'll take some time, I don't think this is pressing)

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