how can I get quick access to var_dump in Visual Studio Code editor? For example: I enter vd
letters and after pressing the Enter key I get var_dump("");
.
VS Code has a global snippets file, as well as snippet files for each language. You can choose to add the snippet in either one.
1) File-->Preferences-->User snippets
2) Select New Global Snippets file
3) Save it as global.code-snippets (or name it anything with the extention code-snippets)
4) Remove everything then paste this in:
{
"Var_Dump": {
"prefix": "vd",
"scope": "php",
"body": [
"var_dump($1);",
"$2"
],
"description": "var_dump"
}
}
1) File-->Preferences-->User snippets-->php.json
2) Remove everything then paste this in:
{
"Var_Dump": {
"prefix": "vd",
"body": [
"var_dump($1);",
"$2"
],
"description": "var_dump"
}
}
Go to a php file (make sure it has opening <?php
tag. Type "vd" and hit tab
VS Code says you don't need to restart your editor, however I found this helped.
Snippets/intellisense can take some time to come up. Wait for the snippet to show up before hitting tab. You are waiting for this:
More info and options can be found on this VS Code help page.