Reputation: 1791
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.
Upvotes: 12
Views: 3108
Reputation: 181218
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);"
]
}
Upvotes: 25