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

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

Open
mawkler opened this issue Aug 31, 2024 · 7 comments
Open

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

mawkler opened this issue Aug 31, 2024 · 7 comments

Comments

@mawkler
Copy link
Contributor

mawkler commented Aug 31, 2024

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

@mireq
Copy link
Owner

mireq commented Sep 7, 2024

@mawkler this triggers for:

  • fun
  • function

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
Copy link
Contributor Author

mawkler commented Sep 9, 2024

@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
Copy link
Owner

mireq commented Sep 9, 2024

@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
Copy link
Contributor Author

mawkler commented Sep 9, 2024

@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
Copy link
Owner

mireq commented Sep 9, 2024

@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
Copy link
Contributor Author

mawkler commented Sep 9, 2024

@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
Copy link
Owner

mireq commented Sep 22, 2024

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

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