-
-
Notifications
You must be signed in to change notification settings - Fork 244
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
Replace snippets with the same name #458
Comments
I want to just say "create a local copy of friendly-snippets and remove those snippets", but it's been brought up a few times now, I think we ought to implement something to support this. There's Maybe we could add a setting which, when set, finds duplicate snippets and removes those with lower priority (or, more precisely, those that would not be expanded when triggering snippets manually). |
That sounds like a fantastic solution |
Great, might be a while until this is added though 😅 |
Have you started working on it yet or should I start looking at it and open a PR? If so, I will add a setting called |
Ah, no I have not so far
|
Would it perhaps be a better idea to filter out duplicates once snippets are queried instead. That way, LSP one-off snippets like those from rust analyzer could also be set to either override yours or the other way around. |
Mhmm, overriding snippets from lsp isn't possible from luasnip (at least not in the way you'd want to I think). We just get the snippet-body and can then refuse to expand it, but the snippets will still show up in To completely prevent duplicates in completion-engines, they would have to filter the list they show and remove duplicates entries. I don't quite know yet how to best do this, the easiest way might even be generating the list of snippets for the current position in |
Ok. Preventing duplicates in lsp snippets isn't such a big deal since they are different sources in nvim-cmp, so you can place luasnip above lsp. The lsp snippets aren't clashing too often with user defined snippets, like the rust-analyzer |
I also would like to override friend-snippets with my own for certain snippets, (e.g. tests). I've tried overriding priority, but friendly-snippets still show up first. Am I doing something wrong with my config?
|
"Show up first" in cmp? Yeah, nothing's implemented to prevent that as of now :/ |
Ah ok, I got confused with how priority was used. That makes sense, I guess yeah then I'd say +1 for being able to 'replace' snippets. |
How about provide a way to ignore or delete specific snippet in loader? |
I also think the abilitiy to override snippets would be super useful! I'm currently using a fork of friendly-snippets like you mentioned @L3MON4D3, but it's not very practical having to keep up with the upstream, deal with merge conflicts, etc. |
Also needing this :). |
I'm interested in this use case as well, especially with cmp ordering being non-trivial to manipulate. Having duplicates not there to begin with would be a much better solution. |
Can I set the priority for snippets loaded with |
When loading snippets from friendly-snippets and your custom config there may be snippets which have the same name/trigger, both of which will show up in the completion menu (nvim-cmp).
It would be useful for an option to replace existing snippets with the same name to allow overriding some predefined snippets with your own, which is how vsnip handled it.
Any input is appreciated.
The text was updated successfully, but these errors were encountered: