-
Notifications
You must be signed in to change notification settings - Fork 18
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
Expand a snippet inside another #63
Comments
Hi. That kind of reference to another snippet from a snippet's body isn't possible, though I agree it would be handy sometimes. I'm not aware of any snippet engine that supports it. |
The snippets engine I used before, vim-vsnip, supports that: https://github.com/hrsh7th/vim-vsnip#features - it calls that feature "nested snippet expansion". As a user I think that feature is awesome, but as a developer I have a feeling this may be not trivial to implement. 😅 Nice to see you tagged this as an enhancement, I would be happy to test it if you decide to work on that, just mention me on this issue. BTW, congrats for your work here! 🚀 I prefer your plugin because your snippets are much, much more cleaner than VSCode's style ones with all that JSON. 😎 |
Interesting. I thought the "nested snippet expansion" referred to expanding a snippet from inside an already expanded snippet, which is also possible with Snippy—that is, you expand a snippet, type the trigger for another snippet, and expand it. Does it mean Vsnip allows to automatically expand a snippet? Can you give an example? |
I guess at least for VS-Code style snippets, it does. I had mine on that format before. Using the same example as the one I opened this issue with, when I triggered the qheader snippet, it already expanded the qtimestamp one. That got me impressed, and I started relying on that funcionality (maybe too much? 🤣) But I did not try it at the time with the snippets on the same format as snippy and vsnip support. So maybe that is particular to VSCode's JSON format? (which I do not intend to use due to parsing the JSON being much more prone to errors). |
Is it possible to expand a snippet inside another? E.g.:
On the example above, on the snippet "qheader", I would like to automatically expand the qtimestamp snippet on the "created" and "modified" fields.
The text was updated successfully, but these errors were encountered: