I'm trying to write a snippet that allows me to console.log().
The following only works when I type con.
"Print to console": {
"prefix": "con",
"body": [
"console.log($1);"
]
}
I want it to work for all the following letters as well (e.g. cons, conso, consol, console).
Is it possible or I have to duplicate the snippet as many times?
Thank you.
See Is there a way to use regex expression in vscode snippet prefix? but not really a duplicate as that question asked about using regexs (which would be pretty interesting) to construct snippet prefixes.
You can put it into one snippet ala:
"Print to console": {
"prefix": ["con", "cons", "conso", ….etc...],
"body": [
"console.log($1);"
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With