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("");
.

- 4,348
- 2
- 24
- 45

- 3
- 1
- 3
2 Answers
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.
Add it to the global file
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"
}
}
Or Add it to the php file
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"
}
}
Usage
Go to a php file (make sure it has opening <?php
tag. Type "vd" and hit tab
Not working?
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.

- 317
- 3
- 14
This is a snippet. HERE you can read how to make it.
You can define your own snippets for specific languages. To open up a snippet file for editing, open User Snippets under File > Preferences (Code> Preferences on Mac) and select the language for which the snippets should appear. Snippets are defined in a JSON format and stored in a per user (languageId).json file. For example, Markdown snippets go in a markdown.json file.

- 33
- 1
- 2
- 9
-
1Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Barmar Feb 24 '18 at 08:00