Skip to content

Instantly share code, notes, and snippets.

@webarthur
Created May 3, 2022 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webarthur/d96e4af0b8cba8c5abf9554eeb7cf105 to your computer and use it in GitHub Desktop.
Save webarthur/d96e4af0b8cba8c5abf9554eeb7cf105 to your computer and use it in GitHub Desktop.
VS Code JavaScript snippets
{
"<router-link>": {
"scope": "html",
"prefix": ["rt", "rou", "rout"],
"body": [
"<router-link to=\"$1\">$2</router-link>"
],
},
"<router-view>": {
"scope": "html",
"prefix": ["rv", "rou", "rout"],
"body": [
"<router-view />"
],
},
"promise.then": {
"scope": "javascript,typescript",
"prefix": ["then", "th"],
"body": [
"then(res => $1)"
],
},
"console.log": {
"scope": "javascript,typescript",
"prefix": ["lo", "log"],
"body": [
"console.log($1)"
],
},
"import": {
"scope": "javascript,typescript",
"prefix": ["imp"],
"body": [
"import $1 from '$2'"
],
},
"import2": {
"scope": "javascript,typescript",
"prefix": ["impp"],
"body": [
"import { $1 } from '$2'"
],
},
"function": {
"scope": "javascript,typescript",
"prefix": "f",
"body": [
"function ($1) {$2}"
],
"description": "JavaScript function"
},
"const": {
"scope": "javascript,typescript",
"prefix": "const",
"body": [
"const $1 = $2"
],
"description": "JavaScript const"
},
"var": {
"scope": "javascript,typescript",
"prefix": "var",
"body": [
"var $1 = $2"
],
"description": "JavaScript const"
},
"let": {
"scope": "javascript,typescript",
"prefix": "let",
"body": [
"let $1 = $2"
],
"description": "JavaScript const"
},
"try": {
"scope": "javascript,typescript",
"prefix": "try",
"body": [
"try {",
"\t$1",
"}",
"catch (e) {",
"\t$2",
"}"
],
"description": "JavaScript const"
},
"async": {
"scope": "javascript,typescript",
"prefix": "as",
"body": [
"async "
],
"description": "JavaScript async"
},
"await": {
"scope": "javascript,typescript",
"prefix": "aw",
"body": [
"await "
],
"description": "JavaScript await"
},
"module.exports": {
"scope": "javascript,typescript",
"prefix": "mod",
"body": [
"module.exports = "
],
// "description": "module"
},
"export default": {
"scope": "javascript,typescript",
"prefix": "exd",
"body": [
"export default {\n\t$1\n}"
],
// "description": "module"
},
"const2": {
"scope": "javascript,typescript",
"prefix": "c",
"body": [
"const $1 = $2"
],
// "description": "module"
},
"typeof": {
"scope": "javascript,typescript",
"prefix": "ty",
"body": [
"typeof($1)"
],
// "description": "module"
},
"const3": {
"scope": "javascript,typescript",
"prefix": "cc",
"body": [
"const { $1 } = $2"
],
// "description": "module"
},
"object function": {
"scope": "javascript,typescript",
"prefix": "ff",
"body": [
"$1 ($2) {\n\t$3\n},"
],
// "description": "module"
},
"arrow function": {
"scope": "javascript,typescript",
"prefix": "af",
"body": [
"($1) => $2"
],
// "description": "module"
},
"object prop to object": {
"scope": "javascript,typescript",
"prefix": "aa",
"body": [
"$1: {\n\t$2\n},"
],
// "description": "module"
},
"array prop to object": {
"scope": "javascript,typescript",
"prefix": "ee",
"body": [
"$1: [],"
],
// "description": "module"
},
"object brackets": {
"scope": "javascript,typescript",
"prefix": "=",
"body": [
"{ $1 }"
],
},
"object brackets 2": {
"scope": "javascript,typescript",
"prefix": ":",
"body": [
": { $1 }"
],
},
"require": {
"scope": "javascript,typescript",
"prefix": "req",
"body": [
"require('$1')"
],
},
"Feathers services": {
"scope": "javascript,typescript",
"prefix": "app.se",
"body": [
"app.service('$1')"
],
},
"Feathers Model": {
"scope": "javascript,typescript",
"prefix": ".M",
"body": [
".Model"
],
},
"else": {
"scope": "javascript,typescript",
"prefix": ["else", "el"],
"body": [
"else {",
"\t$1",
"}",
],
},
"else if": {
"scope": "javascript,typescript",
"prefix": ["elf", "elif"],
"body": [
"else if ($1) {",
"\t$2",
"}",
],
},
"x => ": {
"scope": "javascript,typescript",
"prefix": ["x"],
"body": [
"x => ",
],
},
"setTimeout": {
"scope": "javascript,typescript",
"prefix": ["st"],
"body": [
"setTimeout(($1) => $2)",
],
},
"return": {
"scope": "javascript,typescript",
"prefix": ["re"],
"body": [
"return ",
],
},
"JSON.parse": {
"scope": "javascript,typescript",
"prefix": ["jp"],
"body": [
"JSON.parse($1)",
],
},
"JSON.stringify": {
"scope": "javascript,typescript",
"prefix": ["js"],
"body": [
"JSON.stringify($1)",
],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment