Replies: 1 comment
-
Hi :)
Mhmm, you can get the trigger of the snippet via local function make_similar_snippets(keyword)
return s({trig=keyword}, {t"local function " .. keyword .. "(", i(1), t")"})
end
make_similar_snippets("foo")
make_similar_snippets("bar")
make_similar_snippets("foobar")
Unfortunately not possible right now, and I think implementing it would require either quite a bit of restructuring or some clever trick... If I get a good idea I'll consider it :)
Actually, it might be us doing this, could you check if this also occurs if you specify
Ah, I think we do have this in a roundabout way via this setting, but that works for parsed snippets only 😅 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How do I get the name of the snippet at expand time? This would help with snippet reuse (e.g. some snippets are simple and differ only by name which is the name of a function/identifier/etc. that gets expanded in the snippet while everything else is the same), but the
name
field doesn't appear to exist on the snippet within a function node?Is it possible to not specify jump index and have them filled-in automatically (based on the order that nodes appear)? At least half the time, this is the jump order I want and input manually anyway.
Snippet desc/docs preview win clobbers all consecutive newlines (reduces them to a single
\n
), although this appears to be the doing ofcmp
and/orvim.lsp
functions, and there is a simple workaround (adding a space between any two\n
).Is it possible to nest nodes? Like insert nodes? So that I could delete an entire set of nodes just by pressing
<BS>
(because they would be selected/highlighted) before jumping into them? I don't think just using asnippetNode
works, because IIRC luasnip skips the entiresnippetNode
when jumping and instead jumps to the 1st jumpable node within it. So I guess the only straightforward way to accomplish this is to use a choice node with one of the choices being an "empty" choice?Beta Was this translation helpful? Give feedback.
All reactions