Skip to content

Instantly share code, notes, and snippets.

@wmakeev
Last active June 28, 2019 11:02
Show Gist options
  • Save wmakeev/788ca90a3c244aeea468984ba398c20e to your computer and use it in GitHub Desktop.
Save wmakeev/788ca90a3c244aeea468984ba398c20e to your computer and use it in GitHub Desktop.
Visual Studio Code snippets #vsc #env #snippets
/*
// 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, ${id} and ${id:label} and ${1:label} for variables. Variables with the same id are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
{
"Require module": {
"prefix": "req",
"body": [
"$1 = require('${1:module-name}$2')$3"
],
"description": "Require project module"
}
}
@pawelkleczek10c
Copy link

how do you use it?

@wmakeev
Copy link
Author

wmakeev commented Jun 28, 2019

how do you use it?

Code → Preferences -> User snippets → javascript.json

add:

"require": {
	"prefix": "_req",
	"body": "const $1 = require('$0$1')"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment