LuaSnip icon indicating copy to clipboard operation
LuaSnip copied to clipboard

Match multiple snippets

Open mireq opened this issue 2 years ago • 3 comments

I am trying to convert all UltiSnips snippets to luasnip with exact same behavior (including duplicate triggers, embedded scripts ...).

To reproduce snippet menu (displayed with multiple matches) i need find all matching snippets, but there is only M.match_snippet exposed. I can't use choice node, because match function can be different for each snippet.

It would be nice to have function, which matches all snippets, or at least prio_iter function to implement my own.

mireq avatar Sep 30 '23 06:09 mireq

Oh, we don't have that built-in, I think the most common solution for this is cmp_luasnip

L3MON4D3 avatar Sep 30 '23 06:09 L3MON4D3

This is just autocompletion, right? I want execute trigger and show all matched snippets. For example in actionscript (i don't write actionscript, it's juset first language in alphabetic order) for has 3 different snippets. UltiSnips in this case shows menu with choices. Theoretically i can replicate this behavior with choice node, but it will not work for snippets triggered using different match expression.

for

mireq avatar Sep 30 '23 09:09 mireq

Ahh okay I understand We don't have something like this yet, but it seems like a cool addition. We could just extend the api for match_snippet to optionally return all matches (want to have the option to still abort on first match), and just pass all of them through vim.ui.select().

L3MON4D3 avatar Sep 30 '23 10:09 L3MON4D3