I've made own user snippet code for javascript
"inner backquote concat variable" : {
"prefix": "$",
"body": "\\${$1}",
"description": "concat variable with backquote sting"
}
I want that snippet to work inside backquote string or single quote string when I press '$' like this
but it does not work when inside a string.
How do make the snippet work inside a string?
Add the following snippet in settings.json
"editor.quickSuggestions": {
"strings": true
},
It makes all snippets/emmets working on strings.
Together with @Ridwan's suggestion your example still wouldn't work because you have no space between $
and the backtick
- so vscode does not see the $
as your prefix, it is just part of a larger string and so doesn't look like a unique trigger it is expecting.
You can see this with any snippet in or out of a string (using your snippet):
So the snippet prefix must "stand alone" so to speak so it can be recognized as a separate trigger. And that includes not being next to a "
or backtick
. They must have spaces around them.
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