Skip to content

Instantly share code, notes, and snippets.

@acatl
Last active March 29, 2018 18:12
Show Gist options
  • Save acatl/11e06ac7e4d06ac0833c99a5747ebef9 to your computer and use it in GitHub Desktop.
Save acatl/11e06ac7e4d06ac0833c99a5747ebef9 to your computer and use it in GitHub Desktop.
VSCode 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, $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')",
"$2"
],
"description": "Log output to console"
}
*/
"require": {
"prefix": "req",
"body": [
"const ${1:name} = require('${1:name}')"
],
"description": "require"
},
"console.log": {
"prefix": "log",
"body": [
"console.log('${1:name}', ${1:name})"
],
"description": "console.log"
},
"@typedef": {
"prefix": "typedef",
"body": [
"typedef {${1:type}} ${2:description}"
],
"description": "@typedef"
},
"@property": {
"prefix": "property",
"body": [
"property {${1:type}} ${2:name} - ${3:description}"
],
"description": "@property"
},
"Function Declaration": {
"prefix": "fn",
"body": [
"function ${1:name}() {\n\t//body\n}"
],
"description": "Function Declaration"
},
"Arrow Function": {
"prefix": "arrow",
"body": [
"() => {\n\t${1:body}\n}"
],
"description": "Function Declaration"
},
"Module Method": {
"prefix": "mfn",
"body": [
"function ${1:name}() {\n\t//body\n}\nmodule.exports.${1:name} = ${1:name}"
],
"description": "Module Method"
},
"DescribeBlock": {
"prefix": "desc",
"body": [
"describe('${1:descName}', () => {\n it('should ${2:testName}', () => {\n expect(true)\n })\n})"
],
"description": "New Describe Block"
},
"beforeAllBlock": {
"prefix": "beforeAll",
"body": [
"beforeAll(() => {\n ${1:body}\n})"
],
"description": "New Describe Block"
},
"afterAllBlock": {
"prefix": "afterAll",
"body": [
"afterAll(() => {\n ${1:body}\n})"
],
"description": "New Describe Block"
},
"beforeEachBlock": {
"prefix": "beforeEach",
"body": [
"beforeEach(() => {\n ${1:body}\n})"
],
"description": "New Describe Block"
},
"afterEachBlock": {
"prefix": "afterEach",
"body": [
"afterEach(() => {\n ${1:body}\n})"
],
"description": "New Describe Block"
},
"JestEnv": {
"prefix": "jest",
"body": [
"/* eslint-env jest */"
],
"description": "jest environment"
},
"TestBlock": {
"prefix": "it",
"body": [
"it('should ${1:testName}', () => {\n ${2:body}\n})"
],
"description": "New Test Block"
},
"console.log object": {
"prefix": "jlog",
"body": [
"console.log('${1:varName}', JSON.stringify(${1:varName}, null, 2))\n"
],
"description": "console.log object"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment