I am trying to create a php snippet in visual stydio code. I want that snippet to already include a variable, but when I fire the snippet it removes the dollar sign from the variables:
code snippet:
"Print to console": {
"prefix": "rick",
"body": [
"$rick = $1;",
"dump($rick);",
],
"description": "hace un dump"
}
code resulting from firing the snippet:
rick = ;
dump(rick);
It doesn't work for me to use '\' as an escape character:
"Print to console": {
"prefix": "rick",
"body": [
"\$rick = $1;",
"dump(\$rick);",
],
"description": "hace un dump"
}
it gives me the following error:
Invalid escape character in string.json(261)
To be able to correctly escape the symbol
$
in thesnippet
I recommend two options:put double
$$
:Put double slash
\\
:Answer based on a SOen question