mireq / luasnip-snippets

Vim-snippets (snipMate & UltiSnip Snippets) converted to native luasnip snippets
62 stars 2 forks source link

Is the Lua snippet `fun(ction)?` supposed to look like that? #9

Open mawkler opened 2 months ago

mawkler commented 2 months ago

The Lua snippet fun(ction)? is not expandable for me. Is it supposed to look like that?

mireq commented 1 month ago

@mawkler this triggers for:

Here is source

This is regex trigger and it has no list of alternatives to export to cmp. There are other triggers like lorem(number) which generates lorem ipsum with requested number of words. It's not practically possible to generate list of working alternatives to completion.

mawkler commented 1 month ago

@mireq So what you're saying is that the fun(ction) snippet does not work with LuaSnip? If that's the case, is it possible for luasnip-snippets to filter out those regex snippets so that they don't show up?

mireq commented 1 month ago

@mawkler it works, you can write fun or function. This is more cmp_luasnip issue. I think it should be displayed in list to show possible regex capture.

mawkler commented 1 month ago

@mireq Are you sure that it's a cmp_luasnip issue? I can't activate it with your minimal_lazy.lua config. If I type func, funct, functi, functio or function and press <Tab> with your config it doesn't work.

I can do fun, but that seems to be a different fun snippet.

mireq commented 1 month ago

@mawkler it should trigger only using fun and function. Rregex tells, that it should start with fun and then optionally can have ction suffix (exactly this, not shorter). So only fun and function expands this snippet.

Correct shippet is here. It has higher priority.

mawkler commented 1 month ago

@mireq But, it doesn't trigger for function. When looking at the source snippet from ultisnips I noticed that there's only a fun(ction) and no fun snippet, like lusnip-snippet has. Luasnip-snippets transpiles the ultisnips snippet to Lua, right? Does that mean that there should be fun and function snippet in LuaSnip, rather than a fun and a (broken) fun(ction) snippet?

mireq commented 1 month ago

@mawkler no, it's regular expression for both cases, so fun(ction) matches both, fun and function, but it don't display completion.