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

Python open or closing parenthesis same 3 snippets #179

Closed
argapost opened this issue Sep 23, 2021 · 3 comments
Closed

Python open or closing parenthesis same 3 snippets #179

argapost opened this issue Sep 23, 2021 · 3 comments

Comments

@argapost
Copy link

argapost commented Sep 23, 2021

Hello!

When I open or close parenthesis in python I get the following 3 snippets no matter the function:

image

Can I disable them somehow? I use nvim-cmp. I don't think I had the same problem a couple of days ago.

Thank you in advance.

@argapost argapost changed the title Python open or closing brackets same 3 snippets Python open or closing parenthesis same 3 snippets Sep 23, 2021
@L3MON4D3
Copy link
Owner

Ouh, difficult. I think, generally, optimizing completion is something better tackled in cmp_luasnip.
What could be done from luasnips' side is just removing the offending snippets altogether by iterating over luasnip.snippets.python, finding these snippets (via trigger/name) and setting them to nil.

@argapost
Copy link
Author

Thanks for the answer. So I guess it's better to open an issue in cmp_luasnip which is responsible for the triggering? Because it doesn't make sense that these snippets are triggered whenever I close or open parenthesis.

I tried to delete it with your suggestion by setting nil the luasnip.snippets.python[66] but I get the following error:

Error detected while processing CompleteChanged Autocommands for "*": E5108: Error executing lua ...e/pack/packer/start/cmp_luasnip/lua/cmp_luasnip/init.lua:15: attempt to index local 'snip' (a nil value)

I guess cmp and cmp_luasnip still know about the existence of the snippet and they cannot access it since it is nil.

@L3MON4D3
Copy link
Owner

Oooooh, yeah it probably errors because cmp_luasnip assumes that the table doesn't have holes (which is generally a fine assumption, you could probably move the following snippets up so the hole is filled).

In any case, best open an issue about it in cmp_luasnip, yes 👍 (going to close it here for now)

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