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

Adding custom conditions to snip mate snippets #1229

Open
haasal opened this issue Aug 29, 2024 · 3 comments
Open

Adding custom conditions to snip mate snippets #1229

haasal opened this issue Aug 29, 2024 · 3 comments

Comments

@haasal
Copy link

haasal commented Aug 29, 2024

Is there any way to apply conditions to snip mate snippets?

I.e. is there a way to do the following but as a snip-mate snippet?

s({ trig = "@a", condition = tex.math_mode }, t("\\alpha")),
@L3MON4D3
Copy link
Owner

No, not really, but you can do

ls.parser.parse_snipmate({ trig = "@a", condition = tex.math_mode }, "\\alpha"),

@haasal
Copy link
Author

haasal commented Aug 30, 2024

Thanks! Do you think this would be a feature worth implementing? Either by extending the snipmate syntax (probably a lot of work) or by adding a parameter to the snip-mate/vscode loader.

@L3MON4D3
Copy link
Owner

TBH, I don't think so.
Writing the snippet-body in snipmate is very comfortable, and defining all the options to the snippets in lua is great because we don't need custom parsing/don't need to think about how to define all these operators.
The only minor downside is that one may have to create a second snippet-collection, but that's pretty simple with the lua-loader :)

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