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

Remove description defaulting to the trigger? #1006

Closed
bew opened this issue Sep 17, 2023 · 3 comments
Closed

Remove description defaulting to the trigger? #1006

bew opened this issue Sep 17, 2023 · 3 comments

Comments

@bew
Copy link
Contributor

bew commented Sep 17, 2023

While working on #1005 I noticed the snippet description defaults to the snippet trigger, why?

I'm thinking it would be more flexible to not have a default for the description, and scripts that want to use this could decide to use the trigger as default or not.

For example cmp_luasnip already shows the trigger at the top:
Screenshot_20230917_181405
without a description the doc looks like:
Screenshot_20230917_181700
Which repeats the trigger for no reason
Without the default to trigger that would look like:
Screenshot_20230917_181532
Which is cleaner IMO.

@L3MON4D3
Copy link
Owner

Hmmm good point.
I think my thought process was to just put anything in there, so that consumers habe a simple interface (description is always a string[]). Until now I hadn't considered that we obviously lose the "no-description"-option.

One pragmatic, and backwards compatible way of solving this would be to have consumers check if the description is the same as the trigger. When phrased as "prevent putting the same information twice" it doesn't even seem that bad :D

@bew
Copy link
Contributor Author

bew commented Sep 17, 2023

note: Actually the first text in doc window is the snip name:
https://github.com/saadparwaiz1/cmp_luasnip/blob/18095520391186d634a/lua/cmp_luasnip/init.lua#L36
Which is usually the trigger (unless specified differently while defining the snippet)

I've opened saadparwaiz1/cmp_luasnip#60

@L3MON4D3
Copy link
Owner

Ahhhh alright 👍
I'll close this, I think consumers can take care of this

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