This feature now ships with visual studio code!
Steps to using built-in workspace snippets:
{namehere}.code-snippets
file in .vscode
folder.vscode
folder (not in sub-folders)(Workspace Snippet)
in the intellisense autocomplete dropdownProvide workspace/project level code snippets.
Put snippets at .vscode/snippets/<languageId>.json
For example, .vscode/snippets/javascript.json
{
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log($1);"
],
"description": "Log output to console"
},
"Print to console error": {
"prefix": "error",
"body": [
"console.error($1);"
],
"description": "Log error output to console"
},
}
See this blog post for more info.