mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 16:39:04 +02:00
update cmd line
This commit is contained in:
parent
67a507d530
commit
8c55f6b749
214 changed files with 48553 additions and 48489 deletions
693
snippets/html/javascript/javascript.json
Normal file
693
snippets/html/javascript/javascript.json
Normal file
|
@ -0,0 +1,693 @@
|
|||
{
|
||||
"setImmediate": {
|
||||
"prefix": "sim",
|
||||
"body": "setImmediate(() => {\n\t${0}\n})"
|
||||
},
|
||||
"await": {
|
||||
"prefix": "a",
|
||||
"body": "await ${0}"
|
||||
},
|
||||
"await Promise.all": {
|
||||
"prefix": "apa",
|
||||
"body": "await Promise.all(${1:value})"
|
||||
},
|
||||
"await Promise.all with destructuring": {
|
||||
"prefix": "apad",
|
||||
"body": "const [${0}] = await Promise.all(${1:value})"
|
||||
},
|
||||
"await Promise.all map": {
|
||||
"prefix": "apm",
|
||||
"body": "await Promise.all(${1:array}.map(async (${2:value}) => {\n\t${0}\n}))"
|
||||
},
|
||||
"await sleep": {
|
||||
"prefix": "ast",
|
||||
"body": "await new Promise((r) => setTimeout(r, ${0}))"
|
||||
},
|
||||
"Node callback": {
|
||||
"prefix": "cb",
|
||||
"body": "function (err, ${1:value}) {\n\tif (err) throw err\n\t${0}\n}"
|
||||
},
|
||||
"process.env": {
|
||||
"prefix": "pe",
|
||||
"body": "process.env"
|
||||
},
|
||||
"Promise.all": {
|
||||
"prefix": "pa",
|
||||
"body": "Promise.all(${1:value})"
|
||||
},
|
||||
"Promise.resolve": {
|
||||
"prefix": "prs",
|
||||
"body": "Promise.resolve(${1:value})"
|
||||
},
|
||||
"Promise.reject": {
|
||||
"prefix": "prj",
|
||||
"body": "Promise.reject(${1:value})"
|
||||
},
|
||||
"Promise": {
|
||||
"prefix": "p",
|
||||
"body": "Promise"
|
||||
},
|
||||
"new Promise": {
|
||||
"prefix": "np",
|
||||
"body": "new Promise((resolve, reject) => {\n\t${0}\n})"
|
||||
},
|
||||
"Promise.then": {
|
||||
"prefix": "pt",
|
||||
"body": "${1:promise}.then((${2:value}) => {\n\t${0}\n})"
|
||||
},
|
||||
"Promise.catch": {
|
||||
"prefix": "pc",
|
||||
"body": "${1:promise}.catch(error => {\n\t${0}\n})"
|
||||
},
|
||||
"describe": {
|
||||
"prefix": "desc",
|
||||
"body": "describe('${1:description}', () => {\n\t${0}\n})"
|
||||
},
|
||||
"describe top level": {
|
||||
"prefix": "dt",
|
||||
"body": "describe('${TM_FILENAME_BASE}', () => {\n\t${0}\n})"
|
||||
},
|
||||
"it asynchronous": {
|
||||
"prefix": "it",
|
||||
"body": "it('${1:description}', async () => {\n\t${0}\n})"
|
||||
},
|
||||
"it.todo": {
|
||||
"prefix": "itt",
|
||||
"body": "it.todo('${1:description}')"
|
||||
},
|
||||
"it with a callback": {
|
||||
"prefix": "itd",
|
||||
"body": "it('${1:description}', (done) => {\n\t${0}\n})"
|
||||
},
|
||||
"it synchronous": {
|
||||
"prefix": "its",
|
||||
"body": "it('${1:description}', () => {\n\t${0}\n})"
|
||||
},
|
||||
"before": {
|
||||
"prefix": "bf",
|
||||
"body": "before(async () => {\n\t${0}\n})"
|
||||
},
|
||||
"beforeAll": {
|
||||
"prefix": "ba",
|
||||
"body": "beforeAll(async () => {\n\t${0}\n})"
|
||||
},
|
||||
"beforeEach": {
|
||||
"prefix": "bfe",
|
||||
"body": "beforeEach(async () => {\n\t${0}\n})"
|
||||
},
|
||||
"after": {
|
||||
"prefix": "aft",
|
||||
"body": "after(() => {\n\t${0}\n})"
|
||||
},
|
||||
"afterEach": {
|
||||
"prefix": "afe",
|
||||
"body": "afterEach(() => {\n\t${0}\n})"
|
||||
},
|
||||
"require": {
|
||||
"prefix": "rq",
|
||||
"body": "require('${1:module}')"
|
||||
},
|
||||
"const module = require('module')": {
|
||||
"prefix": "cr",
|
||||
"body": "const ${1:module} = require('${1:module}')"
|
||||
},
|
||||
"exports.member": {
|
||||
"prefix": "em",
|
||||
"body": "exports.${1:member} = ${2:value}"
|
||||
},
|
||||
"module.exports": {
|
||||
"prefix": "me",
|
||||
"body": "module.exports = ${1:name}"
|
||||
},
|
||||
"module as class": {
|
||||
"prefix": "mec",
|
||||
"body": "class ${1:name} {\n\tconstructor (${2:arguments}) {\n\t\t${0}\n\t}\n}\n\nmodule.exports = ${1:name}\n"
|
||||
},
|
||||
"event handler": {
|
||||
"prefix": "on",
|
||||
"body": "${1:emitter}.on('${2:event}', (${3:arguments}) => {\n\t${0}\n})"
|
||||
},
|
||||
"dom event cancel default and propagation": {
|
||||
"prefix": "evc",
|
||||
"body": "ev.preventDefault()\nev.stopPropagation()\nreturn false"
|
||||
},
|
||||
"addEventListener": {
|
||||
"prefix": "ae",
|
||||
"body": "${1:document}.addEventListener('${2:event}', ${3:ev} => {\n\t${0}\n})"
|
||||
},
|
||||
"removeEventListener": {
|
||||
"prefix": "rel",
|
||||
"body": "${1:document}.removeEventListener('${2:event}', ${3:listener})"
|
||||
},
|
||||
"getElementById": {
|
||||
"prefix": "gi",
|
||||
"body": "${1:document}.getElementById('${2:id}')"
|
||||
},
|
||||
"getElementsByClassName": {
|
||||
"prefix": "gc",
|
||||
"body": "Array.from(${1:document}.getElementsByClassName('${2:class}'))"
|
||||
},
|
||||
"getElementsByTagName": {
|
||||
"prefix": "gt",
|
||||
"body": "Array.from(${1:document}.getElementsByTagName('${2:tag}'))"
|
||||
},
|
||||
"querySelector": {
|
||||
"prefix": "qs",
|
||||
"body": "${1:document}.querySelector('${2:selector}')"
|
||||
},
|
||||
"querySelectorAll": {
|
||||
"prefix": "qsa",
|
||||
"body": "Array.from(${1:document}.querySelectorAll('${2:selector}'))"
|
||||
},
|
||||
"createDocumentFragment": {
|
||||
"prefix": "cdf",
|
||||
"body": "${1:document}.createDocumentFragment(${2:elem})"
|
||||
},
|
||||
"createElement": {
|
||||
"prefix": "cel",
|
||||
"body": "${1:document}.createElement(${2:elem})"
|
||||
},
|
||||
"classList.add": {
|
||||
"prefix": "hecla",
|
||||
"body": "${1:el}.classList.add('${2:class}')"
|
||||
},
|
||||
"classList.remove": {
|
||||
"prefix": "heclr",
|
||||
"body": "${1:el}.classList.remove('${2:class}')"
|
||||
},
|
||||
"classList.toggle": {
|
||||
"prefix": "hect",
|
||||
"body": "${1:el}.classList.toggle('${2:class}')"
|
||||
},
|
||||
"getAttribute": {
|
||||
"prefix": "hega",
|
||||
"body": "${1:el}.getAttribute('${2:attr}')"
|
||||
},
|
||||
"removeAttribute": {
|
||||
"prefix": "hera",
|
||||
"body": "${1:el}.removeAttribute('${2:attr}')"
|
||||
},
|
||||
"setAttribute": {
|
||||
"prefix": "hesa",
|
||||
"body": "${1:el}.setAttribute('${2:attr}', ${3:value})"
|
||||
},
|
||||
"appendChild": {
|
||||
"prefix": "heac",
|
||||
"body": "${1:el}.appendChild(${2:elem})"
|
||||
},
|
||||
"removeChild": {
|
||||
"prefix": "herc",
|
||||
"body": "${1:el}.removeChild(${2:elem})"
|
||||
},
|
||||
"forEach loop": {
|
||||
"prefix": "fe",
|
||||
"body": "${1:iterable}.forEach((${2:item}) => {\n\t${0}\n})"
|
||||
},
|
||||
"map": {
|
||||
"prefix": "map",
|
||||
"body": "${1:iterable}.map((${2:item}) => {\n\t${0}\n})"
|
||||
},
|
||||
"reduce": {
|
||||
"prefix": "reduce",
|
||||
"body": "${1:iterable}.reduce((${2:previous}, ${3:current}) => {\n\t${0}\n}${4:, initial})"
|
||||
},
|
||||
"filter": {
|
||||
"prefix": "filter",
|
||||
"body": "${1:iterable}.filter((${2:item}) => {\n\t${0}\n})"
|
||||
},
|
||||
"find": {
|
||||
"prefix": "find",
|
||||
"body": "${1:iterable}.find((${2:item}) => {\n\t${0}\n})"
|
||||
},
|
||||
"every": {
|
||||
"prefix": "every",
|
||||
"body": "${1:iterable}.every((${2:item}) => {\n\t${0}\n})"
|
||||
},
|
||||
"some": {
|
||||
"prefix": "some",
|
||||
"body": "${1:iterable}.some((${2:item}) => {\n\t${0}\n})"
|
||||
},
|
||||
"var statement": {
|
||||
"prefix": "v",
|
||||
"body": "var ${1:name}"
|
||||
},
|
||||
"var assignment": {
|
||||
"prefix": "va",
|
||||
"body": "var ${1:name} = ${2:value}"
|
||||
},
|
||||
"let statement": {
|
||||
"prefix": "l",
|
||||
"body": "let ${1:name}"
|
||||
},
|
||||
"const statement": {
|
||||
"prefix": "c",
|
||||
"body": "const ${1:name}"
|
||||
},
|
||||
"const statement from destructuring": {
|
||||
"prefix": "cd",
|
||||
"body": "const { ${2:prop} } = ${1:value}"
|
||||
},
|
||||
"const statement from array destructuring": {
|
||||
"prefix": "cad",
|
||||
"body": "const [ ${2:prop} ] = ${1:value}"
|
||||
},
|
||||
"const assignment awaited": {
|
||||
"prefix": "ca",
|
||||
"body": "const ${1:name} = await ${2:value}"
|
||||
},
|
||||
"const destructuring assignment awaited": {
|
||||
"prefix": "cda",
|
||||
"body": "const { ${1:name} } = await ${2:value}"
|
||||
},
|
||||
"const arrow function assignment": {
|
||||
"prefix": "cf",
|
||||
"body": "const ${1:name} = (${2:arguments}) => {\n\treturn ${0}\n}"
|
||||
},
|
||||
"let assignment awaited": {
|
||||
"prefix": "la",
|
||||
"body": "let ${1:name} = await ${2:value}"
|
||||
},
|
||||
"const assignment yielded": {
|
||||
"prefix": "cy",
|
||||
"body": "const ${1:name} = yield ${2:value}"
|
||||
},
|
||||
"let assignment yielded": {
|
||||
"prefix": "ly",
|
||||
"body": "let ${1:name} = yield ${2:value}"
|
||||
},
|
||||
"const object": {
|
||||
"prefix": "co",
|
||||
"body": "const ${1:name} = {\n\t${0}\n}"
|
||||
},
|
||||
"const array": {
|
||||
"prefix": "car",
|
||||
"body": "const ${1:name} = [\n\t${0}\n]"
|
||||
},
|
||||
"generate array of integers starting with 1": {
|
||||
"prefix": "gari",
|
||||
"body": "Array.from({ length: ${1:length} }, (v, k) => k + 1)"
|
||||
},
|
||||
"generate array of integers starting with 0": {
|
||||
"prefix": "gari0",
|
||||
"body": "[...Array(${1:length}).keys()]"
|
||||
},
|
||||
"class": {
|
||||
"prefix": "cs",
|
||||
"body": "class ${1:name} {\n\tconstructor (${2:arguments}) {\n\t\t${0}\n\t}\n}"
|
||||
},
|
||||
"class extends": {
|
||||
"prefix": "csx",
|
||||
"body": "class ${1:name} extends ${2:base} {\n\tconstructor (${3:arguments}) {\n\t\tsuper(${3:arguments})\n\t\t${0}\n\t}\n}"
|
||||
},
|
||||
"module export": {
|
||||
"prefix": "e",
|
||||
"body": "export ${1:member}"
|
||||
},
|
||||
"module export const": {
|
||||
"prefix": "ec",
|
||||
"body": "export const ${1:member} = ${2:value}"
|
||||
},
|
||||
"export named function": {
|
||||
"prefix": "ef",
|
||||
"body": "export function ${1:member} (${2:arguments}) {\n\t${0}\n}"
|
||||
},
|
||||
"module default export": {
|
||||
"prefix": "ed",
|
||||
"body": "export default ${1:member}"
|
||||
},
|
||||
"module default export function": {
|
||||
"prefix": "edf",
|
||||
"body": "export default function ${1:name} (${2:arguments}) {\n\t${0}\n}"
|
||||
},
|
||||
"import module": {
|
||||
"prefix": "im",
|
||||
"body": "import ${2:*} from '${1:module}'"
|
||||
},
|
||||
"import module as": {
|
||||
"prefix": "ia",
|
||||
"body": "import ${2:*} as ${3:name} from '${1:module}'"
|
||||
},
|
||||
"import module destructured": {
|
||||
"prefix": "id",
|
||||
"body": "import {$2} from '${1:module}'"
|
||||
},
|
||||
"typeof": {
|
||||
"prefix": "to",
|
||||
"body": "typeof ${1:source} === '${2:undefined}'"
|
||||
},
|
||||
"this": {
|
||||
"prefix": "t",
|
||||
"body": "this."
|
||||
},
|
||||
"instanceof": {
|
||||
"prefix": "iof",
|
||||
"body": "${1:source} instanceof ${2:Object}"
|
||||
},
|
||||
"let and if statement": {
|
||||
"prefix": "lif",
|
||||
"body": "let ${0} \n if (${2:condition}) {\n\t${1}\n}"
|
||||
},
|
||||
"else statement": {
|
||||
"prefix": "el",
|
||||
"body": "else {\n\t${0}\n}"
|
||||
},
|
||||
"else if statement": {
|
||||
"prefix": "ei",
|
||||
"body": "else if (${1:condition}) {\n\t${0}\n}"
|
||||
},
|
||||
"while iteration decrementing": {
|
||||
"prefix": "wid",
|
||||
"body": "let ${1:array}Index = ${1:array}.length\nwhile (${1:array}Index--) {\n\t${0}\n}"
|
||||
},
|
||||
"throw new Error": {
|
||||
"prefix": "tn",
|
||||
"body": "throw new ${0:error}"
|
||||
},
|
||||
"try/catch": {
|
||||
"prefix": "tc",
|
||||
"body": "try {\n\t${0}\n} catch (${1:err}) {\n\t\n}"
|
||||
},
|
||||
"try/finally": {
|
||||
"prefix": "tf",
|
||||
"body": "try {\n\t${0}\n} finally {\n\t\n}"
|
||||
},
|
||||
"try/catch/finally": {
|
||||
"prefix": "tcf",
|
||||
"body": "try {\n\t${0}\n} catch (${1:err}) {\n\t\n} finally {\n\t\n}"
|
||||
},
|
||||
"anonymous function": {
|
||||
"prefix": "fan",
|
||||
"body": "function (${1:arguments}) {${0}}"
|
||||
},
|
||||
"named function": {
|
||||
"prefix": "fn",
|
||||
"body": "function ${1:name} (${2:arguments}) {\n\t${0}\n}"
|
||||
},
|
||||
"async function": {
|
||||
"prefix": "asf",
|
||||
"body": "async function (${1:arguments}) {\n\t${0}\n}"
|
||||
},
|
||||
"async arrow function": {
|
||||
"prefix": "aa",
|
||||
"body": "async (${1:arguments}) => {\n\t${0}\n}"
|
||||
},
|
||||
"immediately-invoked function expression": {
|
||||
"prefix": "iife",
|
||||
"body": ";(function (${1:arguments}) {\n\t${0}\n})(${2})"
|
||||
},
|
||||
"async immediately-invoked function expression": {
|
||||
"prefix": "aiife",
|
||||
"body": ";(async (${1:arguments}) => {\n\t${0}\n})(${2})"
|
||||
},
|
||||
"arrow function": {
|
||||
"prefix": "af",
|
||||
"body": "(${1:arguments}) => ${2:statement}"
|
||||
},
|
||||
"arrow function with destructuring": {
|
||||
"prefix": "fd",
|
||||
"body": "({${1:arguments}}) => ${2:statement}"
|
||||
},
|
||||
"arrow function with destructuring returning destructured": {
|
||||
"prefix": "fdr",
|
||||
"body": "({${1:arguments}}) => ${1:arguments}"
|
||||
},
|
||||
"arrow function with body": {
|
||||
"prefix": "f",
|
||||
"body": "(${1:arguments}) => {\n\t${0}\n}"
|
||||
},
|
||||
"arrow function with return": {
|
||||
"prefix": "fr",
|
||||
"body": "(${1:arguments}) => {\n\treturn ${0}\n}"
|
||||
},
|
||||
"generator function": {
|
||||
"prefix": "gf",
|
||||
"body": "function* (${1:arguments}) {\n\t${0}\n}"
|
||||
},
|
||||
"named generator": {
|
||||
"prefix": "gfn",
|
||||
"body": "function* ${1:name}(${2:arguments}) {\n\t${0}\n}"
|
||||
},
|
||||
"console.log": {
|
||||
"prefix": "cl",
|
||||
"body": "console.log(${0})"
|
||||
},
|
||||
"console.log a variable": {
|
||||
"prefix": "cv",
|
||||
"body": "console.log('${1}:', ${1})"
|
||||
},
|
||||
"console.error": {
|
||||
"prefix": "ce",
|
||||
"body": "console.error(${0})"
|
||||
},
|
||||
"console.warn": {
|
||||
"prefix": "cw",
|
||||
"body": "console.warn(${0})"
|
||||
},
|
||||
"console.dir": {
|
||||
"prefix": "cod",
|
||||
"body": "console.dir('${1}:', ${1})"
|
||||
},
|
||||
"constructor": {
|
||||
"prefix": "cn",
|
||||
"body": "constructor () {\n\t${0}\n}"
|
||||
},
|
||||
"use strict": {
|
||||
"prefix": "uss",
|
||||
"body": "'use strict'"
|
||||
},
|
||||
"JSON.stringify()": {
|
||||
"prefix": "js",
|
||||
"body": "JSON.stringify($0)"
|
||||
},
|
||||
"JSON.parse()": {
|
||||
"prefix": "jp",
|
||||
"body": "JSON.parse($0)"
|
||||
},
|
||||
"method": {
|
||||
"prefix": "m",
|
||||
"body": "${1:method} (${2:arguments}) {\n\t${0}\n}"
|
||||
},
|
||||
"getter": {
|
||||
"prefix": "get",
|
||||
"body": "get ${1:property} () {\n\t${0}\n}"
|
||||
},
|
||||
"setter": {
|
||||
"prefix": "set",
|
||||
"body": "set ${1:property} (${2:value}) {\n\t${0}\n}"
|
||||
},
|
||||
"getter + setter": {
|
||||
"prefix": "gs",
|
||||
"body": "get ${1:property} () {\n\t${0}\n}\nset ${1:property} (${2:value}) {\n\t\n}"
|
||||
},
|
||||
"prototype method": {
|
||||
"prefix": "proto",
|
||||
"body": "${1:Class}.prototype.${2:method} = function (${3:arguments}) {\n\t${0}\n}"
|
||||
},
|
||||
"Object.assign": {
|
||||
"prefix": "oa",
|
||||
"body": "Object.assign(${1:dest}, ${2:source})"
|
||||
},
|
||||
"Object.create": {
|
||||
"prefix": "oc",
|
||||
"body": "Object.create(${1:obj})"
|
||||
},
|
||||
"Object.getOwnPropertyDescriptor": {
|
||||
"prefix": "og",
|
||||
"body": "Object.getOwnPropertyDescriptor(${1:obj}, '${2:prop}')"
|
||||
},
|
||||
"ternary": {
|
||||
"prefix": "te",
|
||||
"body": "${1:cond} ? ${2:true} : ${3:false}"
|
||||
},
|
||||
"ternary assignment": {
|
||||
"prefix": "ta",
|
||||
"body": "const ${0} = ${1:cond} ? ${2:true} : ${3:false}"
|
||||
},
|
||||
"Object.defineProperty": {
|
||||
"prefix": "od",
|
||||
"body": "Object.defineProperty(${1:dest}, '${2:prop}', {\n\t${0}\n})"
|
||||
},
|
||||
"Object.keys": {
|
||||
"prefix": "ok",
|
||||
"body": "Object.keys(${1:obj})"
|
||||
},
|
||||
"Object.values": {
|
||||
"prefix": "ov",
|
||||
"body": "Object.values(${1:obj})"
|
||||
},
|
||||
"Object.entries": {
|
||||
"prefix": "oe",
|
||||
"body": "Object.entries(${1:obj})"
|
||||
},
|
||||
"return": {
|
||||
"prefix": "r",
|
||||
"body": "return ${0}"
|
||||
},
|
||||
"return arrow function": {
|
||||
"prefix": "rf",
|
||||
"body": "return (${1:arguments}) => ${2:statement}"
|
||||
},
|
||||
"yield": {
|
||||
"prefix": "y",
|
||||
"body": "yield ${0}"
|
||||
},
|
||||
"return this": {
|
||||
"prefix": "rt",
|
||||
"body": "return ${0:this}"
|
||||
},
|
||||
"return null": {
|
||||
"prefix": "rn",
|
||||
"body": "return null"
|
||||
},
|
||||
"return new object": {
|
||||
"prefix": "ro",
|
||||
"body": "return {\n\t${0}\n}"
|
||||
},
|
||||
"return new array": {
|
||||
"prefix": "ra",
|
||||
"body": "return [\n\t${0}\n]"
|
||||
},
|
||||
"return promise": {
|
||||
"prefix": "rp",
|
||||
"body": "return new Promise((resolve, reject) => {\n\t${0}\n})"
|
||||
},
|
||||
"wrap selection in arrow function": {
|
||||
"prefix": "wrap selection in arrow function",
|
||||
"body": "() => {\n\t{$TM_SELECTED_TEXT}\n}",
|
||||
"description": "wraps text in arrow function"
|
||||
},
|
||||
"wrap selection in async arrow function": {
|
||||
"prefix": "wrap selection in async arrow function",
|
||||
"body": "async () => {\n\t{$TM_SELECTED_TEXT}\n}",
|
||||
"description": "wraps text in arrow function"
|
||||
},
|
||||
"define module": {
|
||||
"prefix": "define",
|
||||
"body": [
|
||||
"define([",
|
||||
"\t'require',",
|
||||
"\t'${1:dependency}'",
|
||||
"], function(require, ${2:factory}) {",
|
||||
"\t'use strict';",
|
||||
"\t$0",
|
||||
"});"
|
||||
],
|
||||
"description": "define module"
|
||||
},
|
||||
"For Loop": {
|
||||
"prefix": "for",
|
||||
"body": [
|
||||
"for (let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++) {",
|
||||
"\tconst ${3:element} = ${2:array}[${1:index}];",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "For Loop"
|
||||
},
|
||||
"For-Each Loop": {
|
||||
"prefix": "foreach",
|
||||
"body": ["${1:array}.forEach(${2:element} => {", "\t$0", "});"],
|
||||
"description": "For-Each Loop"
|
||||
},
|
||||
"For-In Loop": {
|
||||
"prefix": "forin",
|
||||
"body": [
|
||||
"for (const ${1:key} in ${2:object}) {",
|
||||
"\tif (${2:object}.hasOwnProperty(${1:key})) {",
|
||||
"\t\tconst ${3:element} = ${2:object}[${1:key}];",
|
||||
"\t\t$0",
|
||||
"\t}",
|
||||
"}"
|
||||
],
|
||||
"description": "For-In Loop"
|
||||
},
|
||||
"For-Of Loop": {
|
||||
"prefix": "forof",
|
||||
"body": ["for (const ${1:iterator} of ${2:object}) {", "\t$0", "}"],
|
||||
"description": "For-Of Loop"
|
||||
},
|
||||
"Function Statement": {
|
||||
"prefix": "function",
|
||||
"body": ["function ${1:name}(${2:params}) {", "\t$0", "}"],
|
||||
"description": "Function Statement"
|
||||
},
|
||||
"If Statement": {
|
||||
"prefix": "if",
|
||||
"body": ["if (${1:condition}) {", "\t$0", "}"],
|
||||
"description": "If Statement"
|
||||
},
|
||||
"If-Else Statement": {
|
||||
"prefix": "ifelse",
|
||||
"body": ["if (${1:condition}) {", "\t$0", "} else {", "\t", "}"],
|
||||
"description": "If-Else Statement"
|
||||
},
|
||||
"New Statement": {
|
||||
"prefix": "new",
|
||||
"body": ["const ${1:name} = new ${2:type}(${3:arguments});$0"],
|
||||
"description": "New Statement"
|
||||
},
|
||||
"Switch Statement": {
|
||||
"prefix": "switch",
|
||||
"body": [
|
||||
"switch (${1:key}) {",
|
||||
"\tcase ${2:value}:",
|
||||
"\t\t$0",
|
||||
"\t\tbreak;",
|
||||
"",
|
||||
"\tdefault:",
|
||||
"\t\tbreak;",
|
||||
"}"
|
||||
],
|
||||
"description": "Switch Statement"
|
||||
},
|
||||
"While Statement": {
|
||||
"prefix": "while",
|
||||
"body": ["while (${1:condition}) {", "\t$0", "}"],
|
||||
"description": "While Statement"
|
||||
},
|
||||
"Do-While Statement": {
|
||||
"prefix": "dowhile",
|
||||
"body": ["do {", "\t$0", "} while (${1:condition});"],
|
||||
"description": "Do-While Statement"
|
||||
},
|
||||
"Try-Catch Statement": {
|
||||
"prefix": "trycatch",
|
||||
"body": ["try {", "\t$0", "} catch (${1:error}) {", "\t", "}"],
|
||||
"description": "Try-Catch Statement"
|
||||
},
|
||||
"Set Timeout Function": {
|
||||
"prefix": "settimeout",
|
||||
"body": ["setTimeout(() => {", "\t$0", "}, ${1:timeout});"],
|
||||
"description": "Set Timeout Function"
|
||||
},
|
||||
"Set Interval Function": {
|
||||
"prefix": "setinterval",
|
||||
"body": ["setInterval(() => {", "\t$0", "}, ${1:interval});"],
|
||||
"description": "Set Interval Function"
|
||||
},
|
||||
"Import external module.": {
|
||||
"prefix": "import statement",
|
||||
"body": ["import { $0 } from \"${1:module}\";"],
|
||||
"description": "Import external module."
|
||||
},
|
||||
"Region Start": {
|
||||
"prefix": "#region",
|
||||
"body": ["//#region $0"],
|
||||
"description": "Folding Region Start"
|
||||
},
|
||||
"Region End": {
|
||||
"prefix": "#endregion",
|
||||
"body": ["//#endregion"],
|
||||
"description": "Folding Region End"
|
||||
},
|
||||
"Log warning to console": {
|
||||
"prefix": "warn",
|
||||
"body": ["console.warn($1);", "$0"],
|
||||
"description": "Log warning to the console"
|
||||
},
|
||||
"Log error to console": {
|
||||
"prefix": "error",
|
||||
"body": ["console.error($1);", "$0"],
|
||||
"description": "Log error to the console"
|
||||
}
|
||||
}
|
83
snippets/html/javascript/jsdoc.json
Normal file
83
snippets/html/javascript/jsdoc.json
Normal file
|
@ -0,0 +1,83 @@
|
|||
{
|
||||
"JSDoc Comment": {
|
||||
"prefix": "/*",
|
||||
"body": [
|
||||
"/**\n",
|
||||
" * ${1:Comment}$0\n",
|
||||
"*/"
|
||||
],
|
||||
"description": "A JSDoc comment"
|
||||
},
|
||||
"author email": {
|
||||
"prefix": "@au",
|
||||
"body": [
|
||||
"@author ${1:author_name} [${2:author_email}]"
|
||||
],
|
||||
"description": "@author email (First Last)"
|
||||
},
|
||||
"Lisense desc": {
|
||||
"prefix": "@li",
|
||||
"body": [
|
||||
"@license ${1:MIT}$0"
|
||||
],
|
||||
"description": "@lisence Description"
|
||||
},
|
||||
"Semantic version": {
|
||||
"prefix": "@ver",
|
||||
"body": [
|
||||
"@version ${1:0.1.0}$0"
|
||||
],
|
||||
"description": "@version Semantic version"
|
||||
},
|
||||
"File overview": {
|
||||
"prefix": "@fileo",
|
||||
"body": [
|
||||
"/**\n",
|
||||
" * @fileoverview ${1:Description_of_the_file}$0",
|
||||
"*/"
|
||||
],
|
||||
"description": "@fileoverview Description"
|
||||
},
|
||||
"Contructor": {
|
||||
"prefix": "@constr",
|
||||
"body": [
|
||||
"@contructor"
|
||||
],
|
||||
"description": "@constructor"
|
||||
},
|
||||
"varname": {
|
||||
"prefix": "@p",
|
||||
"body": [
|
||||
"@param ${1:Type} ${2:varname} ${3:Description}"
|
||||
],
|
||||
"description": "@param {Type} varname Description"
|
||||
},
|
||||
"return type desc": {
|
||||
"prefix": "@ret",
|
||||
"body": [
|
||||
"@return ${1:Type} ${2:Description}"
|
||||
],
|
||||
"description": "@return {Type} Description"
|
||||
},
|
||||
"private": {
|
||||
"prefix": "@pri",
|
||||
"body": [
|
||||
"@private"
|
||||
],
|
||||
"description": "@private"
|
||||
},
|
||||
"override": {
|
||||
"prefix": "@over",
|
||||
"body": [
|
||||
"@override"
|
||||
],
|
||||
"description": "@override"
|
||||
},
|
||||
"protected": {
|
||||
"prefix": "@pro",
|
||||
"body": [
|
||||
"@protected"
|
||||
],
|
||||
"description": "@protected"
|
||||
}
|
||||
}
|
95
snippets/html/javascript/next-ts.json
Normal file
95
snippets/html/javascript/next-ts.json
Normal file
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
"import Next.js GetStaticProps type": {
|
||||
"prefix": "igsp",
|
||||
"body": "import { GetStaticProps } from 'next';",
|
||||
"description": "Next.js GetStaticProps type import"
|
||||
},
|
||||
"import Next.js InferGetStaticPropsType": {
|
||||
"prefix": "infg",
|
||||
"body": "import { InferGetStaticPropsType } from 'next'",
|
||||
"description": "Next.js InferGetStaticPropsType import"
|
||||
},
|
||||
"use Next.js InferGetStaticPropsType": {
|
||||
"prefix": "uifg",
|
||||
"body": [
|
||||
"function ${1:${TM_FILENAME_BASE}}({ posts }: InferGetStaticPropsType<typeof getStaticProps>) {",
|
||||
"\treturn $2",
|
||||
"}"
|
||||
],
|
||||
"description": "use InferGetStaticPropsType snippet"
|
||||
},
|
||||
"Next.js Get initial props outside Component": {
|
||||
"prefix": "gip",
|
||||
"body": [
|
||||
"${1:${TM_FILENAME_BASE}}.getInitialProps = async ({ req }) => {",
|
||||
"\treturn $2",
|
||||
"}"
|
||||
],
|
||||
"description": "Next.js Get initial props outside Component"
|
||||
},
|
||||
"Next.js getInitialProps() inside Class Component": {
|
||||
"prefix": "cgip",
|
||||
"body": ["static async getInitialProps() {", "\treturn { $1 };", "}"],
|
||||
"description": "Next.js static async getInitialProps() inside Class Component"
|
||||
},
|
||||
"Next.js getStaticProps() export": {
|
||||
"prefix": "gsp",
|
||||
"body": [
|
||||
"export const getStaticProps: GetStaticProps = async (context) => {",
|
||||
"\treturn {",
|
||||
"\t\tprops: {$1}",
|
||||
"\t};",
|
||||
"}"
|
||||
],
|
||||
"description": "Next.js getStaticProps() export"
|
||||
},
|
||||
"Next.js getStaticPaths() export": {
|
||||
"prefix": "gspt",
|
||||
"body": [
|
||||
"export const getStaticPaths: GetStaticPaths = async () => {",
|
||||
"\treturn {",
|
||||
"\t\tpaths: [",
|
||||
"\t\t\t{ params: { $1 }}",
|
||||
"\t\t],",
|
||||
"\t\tfallback: $2",
|
||||
"\t};",
|
||||
"}"
|
||||
],
|
||||
"description": "Next.js pre-renders all the static paths https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation"
|
||||
},
|
||||
"import Next.js GetStaticPaths type": {
|
||||
"prefix": "igspt",
|
||||
"body": "import { GetStaticPaths } from 'next'",
|
||||
"description": "Next.js GetStaticPaths type import"
|
||||
},
|
||||
"Next.js getServerSideProps() export": {
|
||||
"prefix": "gssp",
|
||||
"body": [
|
||||
"export const getServerSideProps: GetServerSideProps = async (context) => {",
|
||||
"\treturn {",
|
||||
"\t\tprops: {$1}",
|
||||
"\t};",
|
||||
"}"
|
||||
],
|
||||
"description": "Next.js getServerSideProps() export https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering"
|
||||
},
|
||||
"import Next.js GetServerSideProps type": {
|
||||
"prefix": "igss",
|
||||
"body": "import { GetServerSideProps } from 'next'",
|
||||
"description": "Next.js GetServerSideProps type import"
|
||||
},
|
||||
"import Next.js InferGetServerSidePropsType": {
|
||||
"prefix": "ifgss",
|
||||
"body": "import { InferGetServerSidePropsType } from 'next'",
|
||||
"description": "Next.js InferGetServerSidePropsType import"
|
||||
},
|
||||
"use Next.js InferGetServerSidePropsType": {
|
||||
"prefix": "ufgss",
|
||||
"body": [
|
||||
"function ${1:${TM_FILENAME_BASE}}({ data }: InferGetServerSidePropsType<typeof getServerSideProps>) {",
|
||||
"\treturn $2",
|
||||
"}"
|
||||
],
|
||||
"description": "use InferGetServerSidePropsType snippet"
|
||||
}
|
||||
}
|
125
snippets/html/javascript/next.json
Normal file
125
snippets/html/javascript/next.json
Normal file
|
@ -0,0 +1,125 @@
|
|||
{
|
||||
"Next.js Get initial props outside Component": {
|
||||
"prefix": "gip",
|
||||
"body": "${1:${TM_FILENAME_BASE}}.getInitialProps = ({ req }) => {\treturn $2}",
|
||||
"description": "Next.js Get initial props outside Component"
|
||||
},
|
||||
"Next.js getInitialProps() inside Class Component": {
|
||||
"prefix": "cgip",
|
||||
"body": ["static async getInitialProps() {", "\treturn { $1 };", "}"],
|
||||
"description": "Next.js static async getInitialProps() inside Class Component"
|
||||
},
|
||||
"Next.js getStaticProps() export": {
|
||||
"prefix": "gsp",
|
||||
"body": [
|
||||
"export async function getStaticProps(context) {",
|
||||
"\treturn {",
|
||||
"\t\tprops: {$1}",
|
||||
"\t};",
|
||||
"}"
|
||||
],
|
||||
"description": "Next.js getStaticProps() export"
|
||||
},
|
||||
"Next.js getStaticPaths() export": {
|
||||
"prefix": "gspt",
|
||||
"body": [
|
||||
"export async function getStaticPaths() {",
|
||||
"\treturn {",
|
||||
"\t\tpaths: [",
|
||||
"\t\t\t{ params: { $1 }}",
|
||||
"\t\t],",
|
||||
"\t\tfallback: $2",
|
||||
"\t};",
|
||||
"}"
|
||||
],
|
||||
"description": "Next.js pre-renders all the static paths https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation"
|
||||
},
|
||||
"Next.js getServerSideProps() export": {
|
||||
"prefix": "gssp",
|
||||
"body": [
|
||||
"export async function getServerSideProps(context) {",
|
||||
"\treturn {",
|
||||
"\t\tprops: {$1}",
|
||||
"\t};",
|
||||
"}"
|
||||
],
|
||||
"description": "Next.js getServerSideProps() export https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering"
|
||||
},
|
||||
"import Next.js Head": {
|
||||
"prefix": "imh",
|
||||
"body": "import Head from 'next/head';",
|
||||
"description": "Next.js Head import"
|
||||
},
|
||||
"import Next.js Link": {
|
||||
"prefix": "iml",
|
||||
"body": "import Link from 'next/link';",
|
||||
"description": "Next.js Link import"
|
||||
},
|
||||
"Use Next.js Link": {
|
||||
"prefix": "usl",
|
||||
"body": ["<Link href=\"$1\">", "\t<a>", "\t\t$0", "\t</a>", "</Link>"],
|
||||
"description": "Next.js Link Tag with <a>"
|
||||
},
|
||||
"Use Next.js Link With Pathname": {
|
||||
"prefix": "uslp",
|
||||
"body": [
|
||||
"<Link href={{ pathname: \"$1\", query: { queryName: queryValue } }}>",
|
||||
"\t<a>",
|
||||
"\t\t$0",
|
||||
"\t</a>",
|
||||
"</Link>"
|
||||
],
|
||||
"description": "Next.js Link with Pathname"
|
||||
},
|
||||
"Use Next.js LinkTagWithDynmicRoute": {
|
||||
"prefix": "usld",
|
||||
"body": [
|
||||
"<Link href=\"/[$1]\" as={`/${2:SLUG_NAME}`}>",
|
||||
"\t<a>",
|
||||
"\t\t$0",
|
||||
"\t</a>",
|
||||
"</Link>"
|
||||
],
|
||||
"description": "Next.js Link Tag with Dynamic Route"
|
||||
},
|
||||
"importNextRouter": {
|
||||
"prefix": "imro",
|
||||
"body": "import Router from 'next/router';",
|
||||
"description": "Next.js Router import"
|
||||
},
|
||||
"Next.js Router from useRouter": {
|
||||
"prefix": "usro",
|
||||
"body": "const router = useRouter();",
|
||||
"description": "Declare Next.js Router from useRouter"
|
||||
},
|
||||
"Next.js query param from useRouter": {
|
||||
"prefix": "nroq",
|
||||
"body": "const { $1 } = router.query;",
|
||||
"description": "Destructure Next.js query param from Router from useRouter"
|
||||
},
|
||||
"importNextRouterWithRouter": {
|
||||
"prefix": "imrow",
|
||||
"body": "import Router, { withRouter } from 'next/router';",
|
||||
"description": "Next.js Router and { withRouter } import"
|
||||
},
|
||||
"importNextUseRouter": {
|
||||
"prefix": "imuro",
|
||||
"body": "import { useRouter } from 'next/router';",
|
||||
"description": "Next.js { useRouter } import"
|
||||
},
|
||||
"Import Next Image component": {
|
||||
"prefix": "imni",
|
||||
"body": "import Image from 'next/image';",
|
||||
"description": "Next.js 10 Image component import"
|
||||
},
|
||||
"Use sized Next Image component": {
|
||||
"prefix": "usim",
|
||||
"body": "<Image alt=\"$1\" src=\"$1\" width=\"$1\" height=\"$1\" />",
|
||||
"description": "Use sized Next Image component"
|
||||
},
|
||||
"Use unsized Next Image component": {
|
||||
"prefix": "usimu",
|
||||
"body": "<Image alt=\"$1\" src=\"$1\" unsized=\"$1\" />",
|
||||
"description": "Use sized Next Image component"
|
||||
}
|
||||
}
|
1557
snippets/html/javascript/react-es7.json
Normal file
1557
snippets/html/javascript/react-es7.json
Normal file
File diff suppressed because it is too large
Load diff
445
snippets/html/javascript/react-native-ts.json
Normal file
445
snippets/html/javascript/react-native-ts.json
Normal file
|
@ -0,0 +1,445 @@
|
|||
{
|
||||
"statefulComponent": {
|
||||
"prefix": "rnc",
|
||||
"body": [
|
||||
"import React, { Component } from 'react';",
|
||||
"",
|
||||
"import { View } from 'react-native';",
|
||||
"",
|
||||
"// import { Container } from './styles';",
|
||||
"",
|
||||
"export default class ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}} extends Component {",
|
||||
" render() {",
|
||||
" return <View />;",
|
||||
" }",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Create React Native Stateful Component"
|
||||
},
|
||||
"statelessComponent": {
|
||||
"prefix": "rnsc",
|
||||
"body": [
|
||||
"import React from 'react';",
|
||||
"",
|
||||
"import { View } from 'react-native';",
|
||||
"",
|
||||
"// import { Container } from './styles';",
|
||||
"",
|
||||
"const ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}} = () => <View />;",
|
||||
"",
|
||||
"export default ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}};",
|
||||
""
|
||||
],
|
||||
"description": "Create React Native Stateless Component"
|
||||
},
|
||||
"componentFunctional": {
|
||||
"prefix": "rnfc",
|
||||
"body": [
|
||||
"import React from 'react';",
|
||||
"import { View } from 'react-native';",
|
||||
"",
|
||||
"// import { Container } from './styles';",
|
||||
"",
|
||||
"export default function ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}}() {",
|
||||
" return (",
|
||||
" <View />",
|
||||
" );",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Create React Native Functional Component"
|
||||
},
|
||||
"componentFunctionalTypescript": {
|
||||
"prefix": "rnfcc",
|
||||
"body": [
|
||||
"import React from 'react';",
|
||||
"import { View } from 'react-native';",
|
||||
"",
|
||||
"// import { Container } from './styles';",
|
||||
"",
|
||||
"const ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}}: React.FC = () => {",
|
||||
" return <View />;",
|
||||
"}",
|
||||
"",
|
||||
"export default ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}};"
|
||||
],
|
||||
"description": "Create React Native TypeScript Functional Component"
|
||||
},
|
||||
"styles": {
|
||||
"prefix": "styled-rn",
|
||||
"body": [
|
||||
"import styled from 'styled-components/native';",
|
||||
"",
|
||||
"export const ${1:Container} = styled.${2:View}`",
|
||||
" ${3}",
|
||||
"`;",
|
||||
""
|
||||
],
|
||||
"description": "Create React Native Styled Components file"
|
||||
},
|
||||
"StyleSheet": {
|
||||
"prefix": "rn-stylesheet",
|
||||
"body": [
|
||||
"const ${1:styles} = StyleSheet.create({",
|
||||
" ${2:container}: {",
|
||||
" ${3}",
|
||||
" },",
|
||||
"});",
|
||||
""
|
||||
],
|
||||
"description": "Create React Native Styled Components StyleSheet"
|
||||
},
|
||||
"justifyContent": {
|
||||
"prefix": "just",
|
||||
"body": "justifyContent: '${1:center}',",
|
||||
"description": "justifyContent"
|
||||
},
|
||||
"alignItems": {
|
||||
"prefix": "align",
|
||||
"body": "alignItems: '${1:center}',",
|
||||
"description": "alignItems"
|
||||
},
|
||||
"alignSelf": {
|
||||
"prefix": "align",
|
||||
"body": "alignSelf: '${1:center}',",
|
||||
"description": "alignSelf"
|
||||
},
|
||||
"alignContent": {
|
||||
"prefix": "align",
|
||||
"body": "alignContent: '${1}',",
|
||||
"description": "alignContent"
|
||||
},
|
||||
"aspectRatio": {
|
||||
"prefix": "as",
|
||||
"body": "aspectRatio: '${1}',",
|
||||
"description": "aspectRatio"
|
||||
},
|
||||
"borderBottomWidth": {
|
||||
"prefix": "bor",
|
||||
"body": "borderBottomWidth: ${1},",
|
||||
"description": "borderBottomWidth"
|
||||
},
|
||||
"borderLeftWidth": {
|
||||
"prefix": "bor",
|
||||
"body": "borderLeftWidth: ${1},",
|
||||
"description": "borderLeftWidth"
|
||||
},
|
||||
"borderRightWidth": {
|
||||
"prefix": "bor",
|
||||
"body": "borderRightWidth: ${1},",
|
||||
"description": "borderRightWidth"
|
||||
},
|
||||
"borderTopWidth": {
|
||||
"prefix": "bor",
|
||||
"body": "borderTopWidth: ${1},",
|
||||
"description": "borderTopWidth"
|
||||
},
|
||||
"borderWidth": {
|
||||
"prefix": "bor",
|
||||
"body": "borderWidth: ${1},",
|
||||
"description": "borderWidth"
|
||||
},
|
||||
"borderColor": {
|
||||
"prefix": "bor",
|
||||
"body": "borderColor: ${1},",
|
||||
"description": "borderColor"
|
||||
},
|
||||
"borderRadius": {
|
||||
"prefix": "bor",
|
||||
"body": "borderRadius: ${1},",
|
||||
"description": "borderRadius"
|
||||
},
|
||||
"borderLeftColor": {
|
||||
"prefix": "bor",
|
||||
"body": "borderLeftColor: ${1},",
|
||||
"description": "borderLeftColor"
|
||||
},
|
||||
"borderRightColor": {
|
||||
"prefix": "bor",
|
||||
"body": "borderRightColor: ${1},",
|
||||
"description": "borderRightColor"
|
||||
},
|
||||
"borderTopColor": {
|
||||
"prefix": "bor",
|
||||
"body": "borderTopColor: ${1},",
|
||||
"description": "borderTopColor"
|
||||
},
|
||||
"borderBottomColor": {
|
||||
"prefix": "bor",
|
||||
"body": "borderBottomColor: ${1},",
|
||||
"description": "borderBottomColor"
|
||||
},
|
||||
"borderBottomLeftRadius": {
|
||||
"prefix": "bor",
|
||||
"body": "borderBottomLeftRadius: ${1},",
|
||||
"description": "borderBottomLeftRadius"
|
||||
},
|
||||
"borderBottomRightRadius": {
|
||||
"prefix": "bor",
|
||||
"body": "borderBottomRightRadius: ${1},",
|
||||
"description": "borderBottomRightRadius"
|
||||
},
|
||||
"borderTopLeftRadius": {
|
||||
"prefix": "bor",
|
||||
"body": "borderTopLeftRadius: ${1},",
|
||||
"description": "borderTopLeftRadius"
|
||||
},
|
||||
"borderTopRightRadius": {
|
||||
"prefix": "bor",
|
||||
"body": "borderTopRightRadius: ${1},",
|
||||
"description": "borderTopRightRadius"
|
||||
},
|
||||
"backgroundColor": {
|
||||
"prefix": "bac",
|
||||
"body": "backgroundColor: ${1},",
|
||||
"description": "backgroundColor"
|
||||
},
|
||||
"display": {
|
||||
"prefix": "di",
|
||||
"body": "display: '${1:none}',",
|
||||
"description": "display"
|
||||
},
|
||||
"opacity": {
|
||||
"prefix": "op",
|
||||
"body": "opacity: ${1},",
|
||||
"description": "opacity"
|
||||
},
|
||||
"shadowColor": {
|
||||
"prefix": "sha",
|
||||
"body": "shadowColor: '${1:none}',",
|
||||
"description": "shadowColor"
|
||||
},
|
||||
"shadowOffset": {
|
||||
"prefix": "sha",
|
||||
"body": "shadowOffset: ${1},",
|
||||
"description": "shadowOffset"
|
||||
},
|
||||
"shadowOpacity": {
|
||||
"prefix": "sha",
|
||||
"body": "shadowOpacity: ${1},",
|
||||
"description": "shadowOpacity"
|
||||
},
|
||||
"shadowRadius": {
|
||||
"prefix": "sha",
|
||||
"body": "shadowRadius: ${1},",
|
||||
"description": "shadowRadius"
|
||||
},
|
||||
"elevation": {
|
||||
"prefix": "e",
|
||||
"body": "elevation: ${1},",
|
||||
"description": "elevation"
|
||||
},
|
||||
"flex": {
|
||||
"prefix": "flex",
|
||||
"body": "flex: ${1},",
|
||||
"description": "flex"
|
||||
},
|
||||
"flexBasis": {
|
||||
"prefix": "flex",
|
||||
"body": "flexBasis: '${1}',",
|
||||
"description": "flexBasis"
|
||||
},
|
||||
"flexDirection": {
|
||||
"prefix": "flex",
|
||||
"body": "flexDirection: '${1:column}',",
|
||||
"description": "flexDirection"
|
||||
},
|
||||
"flexGrow": {
|
||||
"prefix": "flex",
|
||||
"body": "flexGrow: '${1}',",
|
||||
"description": "flexGrow"
|
||||
},
|
||||
"flexShrink": {
|
||||
"prefix": "flex",
|
||||
"body": "flexShrink: '${1}',",
|
||||
"description": "flexShrink"
|
||||
},
|
||||
"flexWrap": {
|
||||
"prefix": "flex",
|
||||
"body": "flexWrap: '${1}',",
|
||||
"description": "flexWrap"
|
||||
},
|
||||
"fontSize": {
|
||||
"prefix": "fo",
|
||||
"body": "fontSize: ${1},",
|
||||
"description": "fontSize"
|
||||
},
|
||||
"fontStyle": {
|
||||
"prefix": "fo",
|
||||
"body": "fontStyle: '${1:normal}',",
|
||||
"description": "fontStyle"
|
||||
},
|
||||
"fontFamily": {
|
||||
"prefix": "fo",
|
||||
"body": "fontFamily: '${1}',",
|
||||
"description": "fontFamily"
|
||||
},
|
||||
"fontWeight": {
|
||||
"prefix": "fo",
|
||||
"body": "fontWeight: '${1:normal}',",
|
||||
"description": "fontWeight"
|
||||
},
|
||||
"height": {
|
||||
"prefix": "h",
|
||||
"body": "height: ${1},",
|
||||
"description": "height"
|
||||
},
|
||||
"left": {
|
||||
"prefix": "l",
|
||||
"body": "left: ${1},",
|
||||
"description": "left"
|
||||
},
|
||||
"margin": {
|
||||
"prefix": "mar",
|
||||
"body": "margin: '${1}',",
|
||||
"description": "margin"
|
||||
},
|
||||
"marginBottom": {
|
||||
"prefix": "mar",
|
||||
"body": "marginBottom: ${1},",
|
||||
"description": "marginBottom"
|
||||
},
|
||||
"marginHorizontal": {
|
||||
"prefix": "mar",
|
||||
"body": "marginHorizontal: '${1}',",
|
||||
"description": "marginHorizontal"
|
||||
},
|
||||
"marginLeft": {
|
||||
"prefix": "mar",
|
||||
"body": "marginLeft: ${1},",
|
||||
"description": "marginLeft"
|
||||
},
|
||||
"marginRight": {
|
||||
"prefix": "mar",
|
||||
"body": "marginRight: ${1},",
|
||||
"description": "marginRight"
|
||||
},
|
||||
"marginTop": {
|
||||
"prefix": "mar",
|
||||
"body": "marginTop: ${1},",
|
||||
"description": "marginTop"
|
||||
},
|
||||
"marginVertical": {
|
||||
"prefix": "mar",
|
||||
"body": "marginVertical: '${1}',",
|
||||
"description": "marginVertical"
|
||||
},
|
||||
"maxHeight": {
|
||||
"prefix": "max",
|
||||
"body": "maxHeight: ${1},",
|
||||
"description": "maxHeight"
|
||||
},
|
||||
"maxWidth": {
|
||||
"prefix": "max",
|
||||
"body": "maxWidth: ${1},",
|
||||
"description": "maxWidth"
|
||||
},
|
||||
"minHeight": {
|
||||
"prefix": "min",
|
||||
"body": "minHeight: ${1},",
|
||||
"description": "minHeight"
|
||||
},
|
||||
"minWidth": {
|
||||
"prefix": "min",
|
||||
"body": "minWidth: ${1},",
|
||||
"description": "minWidth"
|
||||
},
|
||||
"overflow": {
|
||||
"prefix": "over",
|
||||
"body": "overflow: '${1}',",
|
||||
"description": "overflow"
|
||||
},
|
||||
"padding": {
|
||||
"prefix": "padding",
|
||||
"body": "padding: ${1},",
|
||||
"description": "padding"
|
||||
},
|
||||
"paddingBottom": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingBottom: ${1},",
|
||||
"description": "paddingBottom"
|
||||
},
|
||||
"paddingHorizontal": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingHorizontal: ${1},",
|
||||
"description": "paddingHorizontal"
|
||||
},
|
||||
"paddingLeft": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingLeft: ${1},",
|
||||
"description": "paddingLeft"
|
||||
},
|
||||
"paddingRight": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingRight: ${1},",
|
||||
"description": "paddingRight"
|
||||
},
|
||||
"paddingTop": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingTop: ${1},",
|
||||
"description": "paddingTop"
|
||||
},
|
||||
"paddingVertical": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingVertical: ${1},",
|
||||
"description": "paddingVertical"
|
||||
},
|
||||
"position": {
|
||||
"prefix": "pos",
|
||||
"body": "position: ${1},",
|
||||
"description": "position"
|
||||
},
|
||||
"right": {
|
||||
"prefix": "ri",
|
||||
"body": "right: ${1},",
|
||||
"description": "right"
|
||||
},
|
||||
"top": {
|
||||
"prefix": "top",
|
||||
"body": "top: ${1},",
|
||||
"description": "top"
|
||||
},
|
||||
"width": {
|
||||
"prefix": "w",
|
||||
"body": "width: ${1},",
|
||||
"description": "width"
|
||||
},
|
||||
"zIndex": {
|
||||
"prefix": "z",
|
||||
"body": "zIndex: ${1},",
|
||||
"description": "zIndex"
|
||||
},
|
||||
"api": {
|
||||
"prefix": "api",
|
||||
"body": [
|
||||
"import axios from 'axios';",
|
||||
"",
|
||||
"const api = axios.create({",
|
||||
" baseURL: ${1},",
|
||||
"});",
|
||||
"",
|
||||
"export default api;",
|
||||
""
|
||||
],
|
||||
"description": "Create Axios Configuration file"
|
||||
},
|
||||
"region": {
|
||||
"prefix": "region",
|
||||
"body": [
|
||||
"//#region ${1}",
|
||||
"${2}",
|
||||
"//#endregion"
|
||||
],
|
||||
"description": "Create region"
|
||||
},
|
||||
"regionStartEnd": {
|
||||
"prefix": "#regionStartEnd",
|
||||
"body": [
|
||||
"//#region ${1}",
|
||||
"${2}",
|
||||
"//#endregion"
|
||||
],
|
||||
"description": "Create region"
|
||||
}
|
||||
}
|
476
snippets/html/javascript/react-native.json
Normal file
476
snippets/html/javascript/react-native.json
Normal file
|
@ -0,0 +1,476 @@
|
|||
{
|
||||
"statefulComponent": {
|
||||
"prefix": "rnc",
|
||||
"body": [
|
||||
"import React, { Component } from 'react';",
|
||||
"",
|
||||
"import { View } from 'react-native';",
|
||||
"",
|
||||
"// import { Container } from './styles';",
|
||||
"",
|
||||
"export default class ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}} extends Component {",
|
||||
" render() {",
|
||||
" return <View />;",
|
||||
" }",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Create React Native Stateful Component"
|
||||
},
|
||||
"statefulReduxComponent": {
|
||||
"prefix": "rnrc",
|
||||
"body": [
|
||||
"import React, { Component } from 'react';",
|
||||
"",
|
||||
"import { View } from 'react-native';",
|
||||
"",
|
||||
"import { bindActionCreators } from 'redux';",
|
||||
"import { connect } from 'react-redux';",
|
||||
"",
|
||||
"// import { Container } from './styles';",
|
||||
"",
|
||||
"class ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}} extends Component {",
|
||||
" render() {",
|
||||
" return <View />;",
|
||||
" }",
|
||||
"}",
|
||||
"",
|
||||
"const mapStateToProps = state => ({});",
|
||||
"",
|
||||
"// const mapDispatchToProps = dispatch =>",
|
||||
"// bindActionCreators(Actions, dispatch);",
|
||||
"",
|
||||
"export default connect(",
|
||||
" mapStateToProps,",
|
||||
" // mapDispatchToProps",
|
||||
")(${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}});",
|
||||
""
|
||||
],
|
||||
"description": "Create React Native Stateful Redux Component"
|
||||
},
|
||||
"statelessComponent": {
|
||||
"prefix": "rnsc",
|
||||
"body": [
|
||||
"import React from 'react';",
|
||||
"",
|
||||
"import { View } from 'react-native';",
|
||||
"",
|
||||
"// import { Container } from './styles';",
|
||||
"",
|
||||
"const ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}} = () => <View />;",
|
||||
"",
|
||||
"export default ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}};",
|
||||
""
|
||||
],
|
||||
"description": "Create React Native Stateless Component"
|
||||
},
|
||||
"componentFunctional": {
|
||||
"prefix": "rnfc",
|
||||
"body": [
|
||||
"import React from 'react';",
|
||||
"import { View } from 'react-native';",
|
||||
"",
|
||||
"// import { Container } from './styles';",
|
||||
"",
|
||||
"export default function ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}}() {",
|
||||
" return (",
|
||||
" <View />",
|
||||
" );",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Create React Native Functional Component"
|
||||
},
|
||||
"componentFunctionalTypescript": {
|
||||
"prefix": "rnfcc",
|
||||
"body": [
|
||||
"import React from 'react';",
|
||||
"import { View } from 'react-native';",
|
||||
"",
|
||||
"// import { Container } from './styles';",
|
||||
"",
|
||||
"const ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}} = () => {",
|
||||
" return <View />;",
|
||||
"}",
|
||||
"",
|
||||
"export default ${1:${TM_DIRECTORY/^.*(\\/|\\\\)([^(\\/|\\\\)]+)$/$2/}};"
|
||||
],
|
||||
"description": "Create React Native Functional Component"
|
||||
},
|
||||
"styles": {
|
||||
"prefix": "styled-rn",
|
||||
"body": [
|
||||
"import styled from 'styled-components/native';",
|
||||
"",
|
||||
"export const ${1:Container} = styled.${2:View}`",
|
||||
" ${3}",
|
||||
"`;",
|
||||
""
|
||||
],
|
||||
"description": "Create React Native Styled Components file"
|
||||
},
|
||||
"StyleSheet": {
|
||||
"prefix": "rn-stylesheet",
|
||||
"body": [
|
||||
"const ${1:styles} = StyleSheet.create({",
|
||||
" ${2:container}: {",
|
||||
" ${3}",
|
||||
" },",
|
||||
"});",
|
||||
""
|
||||
],
|
||||
"description": "Create React Native Styled Components StyleSheet"
|
||||
},
|
||||
"justifyContent": {
|
||||
"prefix": "just",
|
||||
"body": "justifyContent: '${1:center}',",
|
||||
"description": "justifyContent"
|
||||
},
|
||||
"alignItems": {
|
||||
"prefix": "align",
|
||||
"body": "alignItems: '${1:center}',",
|
||||
"description": "alignItems"
|
||||
},
|
||||
"alignSelf": {
|
||||
"prefix": "align",
|
||||
"body": "alignSelf: '${1:center}',",
|
||||
"description": "alignSelf"
|
||||
},
|
||||
"alignContent": {
|
||||
"prefix": "align",
|
||||
"body": "alignContent: '${1}',",
|
||||
"description": "alignContent"
|
||||
},
|
||||
"aspectRatio": {
|
||||
"prefix": "as",
|
||||
"body": "aspectRatio: '${1}',",
|
||||
"description": "aspectRatio"
|
||||
},
|
||||
"borderBottomWidth": {
|
||||
"prefix": "bor",
|
||||
"body": "borderBottomWidth: ${1},",
|
||||
"description": "borderBottomWidth"
|
||||
},
|
||||
"borderLeftWidth": {
|
||||
"prefix": "bor",
|
||||
"body": "borderLeftWidth: ${1},",
|
||||
"description": "borderLeftWidth"
|
||||
},
|
||||
"borderRightWidth": {
|
||||
"prefix": "bor",
|
||||
"body": "borderRightWidth: ${1},",
|
||||
"description": "borderRightWidth"
|
||||
},
|
||||
"borderTopWidth": {
|
||||
"prefix": "bor",
|
||||
"body": "borderTopWidth: ${1},",
|
||||
"description": "borderTopWidth"
|
||||
},
|
||||
"borderWidth": {
|
||||
"prefix": "bor",
|
||||
"body": "borderWidth: ${1},",
|
||||
"description": "borderWidth"
|
||||
},
|
||||
"borderColor": {
|
||||
"prefix": "bor",
|
||||
"body": "borderColor: ${1},",
|
||||
"description": "borderColor"
|
||||
},
|
||||
"borderRadius": {
|
||||
"prefix": "bor",
|
||||
"body": "borderRadius: ${1},",
|
||||
"description": "borderRadius"
|
||||
},
|
||||
"borderLeftColor": {
|
||||
"prefix": "bor",
|
||||
"body": "borderLeftColor: ${1},",
|
||||
"description": "borderLeftColor"
|
||||
},
|
||||
"borderRightColor": {
|
||||
"prefix": "bor",
|
||||
"body": "borderRightColor: ${1},",
|
||||
"description": "borderRightColor"
|
||||
},
|
||||
"borderTopColor": {
|
||||
"prefix": "bor",
|
||||
"body": "borderTopColor: ${1},",
|
||||
"description": "borderTopColor"
|
||||
},
|
||||
"borderBottomColor": {
|
||||
"prefix": "bor",
|
||||
"body": "borderBottomColor: ${1},",
|
||||
"description": "borderBottomColor"
|
||||
},
|
||||
"borderBottomLeftRadius": {
|
||||
"prefix": "bor",
|
||||
"body": "borderBottomLeftRadius: ${1},",
|
||||
"description": "borderBottomLeftRadius"
|
||||
},
|
||||
"borderBottomRightRadius": {
|
||||
"prefix": "bor",
|
||||
"body": "borderBottomRightRadius: ${1},",
|
||||
"description": "borderBottomRightRadius"
|
||||
},
|
||||
"borderTopLeftRadius": {
|
||||
"prefix": "bor",
|
||||
"body": "borderTopLeftRadius: ${1},",
|
||||
"description": "borderTopLeftRadius"
|
||||
},
|
||||
"borderTopRightRadius": {
|
||||
"prefix": "bor",
|
||||
"body": "borderTopRightRadius: ${1},",
|
||||
"description": "borderTopRightRadius"
|
||||
},
|
||||
"backgroundColor": {
|
||||
"prefix": "bac",
|
||||
"body": "backgroundColor: ${1},",
|
||||
"description": "backgroundColor"
|
||||
},
|
||||
"display": {
|
||||
"prefix": "di",
|
||||
"body": "display: '${1:none}',",
|
||||
"description": "display"
|
||||
},
|
||||
"opacity": {
|
||||
"prefix": "op",
|
||||
"body": "opacity: ${1},",
|
||||
"description": "opacity"
|
||||
},
|
||||
"shadowColor": {
|
||||
"prefix": "sha",
|
||||
"body": "shadowColor: '${1:none}',",
|
||||
"description": "shadowColor"
|
||||
},
|
||||
"shadowOffset": {
|
||||
"prefix": "sha",
|
||||
"body": "shadowOffset: ${1},",
|
||||
"description": "shadowOffset"
|
||||
},
|
||||
"shadowOpacity": {
|
||||
"prefix": "sha",
|
||||
"body": "shadowOpacity: ${1},",
|
||||
"description": "shadowOpacity"
|
||||
},
|
||||
"shadowRadius": {
|
||||
"prefix": "sha",
|
||||
"body": "shadowRadius: ${1},",
|
||||
"description": "shadowRadius"
|
||||
},
|
||||
"elevation": {
|
||||
"prefix": "e",
|
||||
"body": "elevation: ${1},",
|
||||
"description": "elevation"
|
||||
},
|
||||
"flex": {
|
||||
"prefix": "flex",
|
||||
"body": "flex: ${1},",
|
||||
"description": "flex"
|
||||
},
|
||||
"flexBasis": {
|
||||
"prefix": "flex",
|
||||
"body": "flexBasis: '${1}',",
|
||||
"description": "flexBasis"
|
||||
},
|
||||
"flexDirection": {
|
||||
"prefix": "flex",
|
||||
"body": "flexDirection: '${1:column}',",
|
||||
"description": "flexDirection"
|
||||
},
|
||||
"flexGrow": {
|
||||
"prefix": "flex",
|
||||
"body": "flexGrow: '${1}',",
|
||||
"description": "flexGrow"
|
||||
},
|
||||
"flexShrink": {
|
||||
"prefix": "flex",
|
||||
"body": "flexShrink: '${1}',",
|
||||
"description": "flexShrink"
|
||||
},
|
||||
"flexWrap": {
|
||||
"prefix": "flex",
|
||||
"body": "flexWrap: '${1}',",
|
||||
"description": "flexWrap"
|
||||
},
|
||||
"fontSize": {
|
||||
"prefix": "fo",
|
||||
"body": "fontSize: ${1},",
|
||||
"description": "fontSize"
|
||||
},
|
||||
"fontStyle": {
|
||||
"prefix": "fo",
|
||||
"body": "fontStyle: '${1:normal}',",
|
||||
"description": "fontStyle"
|
||||
},
|
||||
"fontFamily": {
|
||||
"prefix": "fo",
|
||||
"body": "fontFamily: '${1}',",
|
||||
"description": "fontFamily"
|
||||
},
|
||||
"fontWeight": {
|
||||
"prefix": "fo",
|
||||
"body": "fontWeight: '${1:normal}',",
|
||||
"description": "fontWeight"
|
||||
},
|
||||
"height": {
|
||||
"prefix": "h",
|
||||
"body": "height: ${1},",
|
||||
"description": "height"
|
||||
},
|
||||
"left": {
|
||||
"prefix": "l",
|
||||
"body": "left: ${1},",
|
||||
"description": "left"
|
||||
},
|
||||
"margin": {
|
||||
"prefix": "mar",
|
||||
"body": "margin: '${1}',",
|
||||
"description": "margin"
|
||||
},
|
||||
"marginBottom": {
|
||||
"prefix": "mar",
|
||||
"body": "marginBottom: ${1},",
|
||||
"description": "marginBottom"
|
||||
},
|
||||
"marginHorizontal": {
|
||||
"prefix": "mar",
|
||||
"body": "marginHorizontal: '${1}',",
|
||||
"description": "marginHorizontal"
|
||||
},
|
||||
"marginLeft": {
|
||||
"prefix": "mar",
|
||||
"body": "marginLeft: ${1},",
|
||||
"description": "marginLeft"
|
||||
},
|
||||
"marginRight": {
|
||||
"prefix": "mar",
|
||||
"body": "marginRight: ${1},",
|
||||
"description": "marginRight"
|
||||
},
|
||||
"marginTop": {
|
||||
"prefix": "mar",
|
||||
"body": "marginTop: ${1},",
|
||||
"description": "marginTop"
|
||||
},
|
||||
"marginVertical": {
|
||||
"prefix": "mar",
|
||||
"body": "marginVertical: '${1}',",
|
||||
"description": "marginVertical"
|
||||
},
|
||||
"maxHeight": {
|
||||
"prefix": "max",
|
||||
"body": "maxHeight: ${1},",
|
||||
"description": "maxHeight"
|
||||
},
|
||||
"maxWidth": {
|
||||
"prefix": "max",
|
||||
"body": "maxWidth: ${1},",
|
||||
"description": "maxWidth"
|
||||
},
|
||||
"minHeight": {
|
||||
"prefix": "min",
|
||||
"body": "minHeight: ${1},",
|
||||
"description": "minHeight"
|
||||
},
|
||||
"minWidth": {
|
||||
"prefix": "min",
|
||||
"body": "minWidth: ${1},",
|
||||
"description": "minWidth"
|
||||
},
|
||||
"overflow": {
|
||||
"prefix": "over",
|
||||
"body": "overflow: '${1}',",
|
||||
"description": "overflow"
|
||||
},
|
||||
"padding": {
|
||||
"prefix": "padding",
|
||||
"body": "padding: ${1},",
|
||||
"description": "padding"
|
||||
},
|
||||
"paddingBottom": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingBottom: ${1},",
|
||||
"description": "paddingBottom"
|
||||
},
|
||||
"paddingHorizontal": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingHorizontal: ${1},",
|
||||
"description": "paddingHorizontal"
|
||||
},
|
||||
"paddingLeft": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingLeft: ${1},",
|
||||
"description": "paddingLeft"
|
||||
},
|
||||
"paddingRight": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingRight: ${1},",
|
||||
"description": "paddingRight"
|
||||
},
|
||||
"paddingTop": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingTop: ${1},",
|
||||
"description": "paddingTop"
|
||||
},
|
||||
"paddingVertical": {
|
||||
"prefix": "padding",
|
||||
"body": "paddingVertical: ${1},",
|
||||
"description": "paddingVertical"
|
||||
},
|
||||
"position": {
|
||||
"prefix": "pos",
|
||||
"body": "position: ${1},",
|
||||
"description": "position"
|
||||
},
|
||||
"right": {
|
||||
"prefix": "ri",
|
||||
"body": "right: ${1},",
|
||||
"description": "right"
|
||||
},
|
||||
"top": {
|
||||
"prefix": "top",
|
||||
"body": "top: ${1},",
|
||||
"description": "top"
|
||||
},
|
||||
"width": {
|
||||
"prefix": "w",
|
||||
"body": "width: ${1},",
|
||||
"description": "width"
|
||||
},
|
||||
"zIndex": {
|
||||
"prefix": "z",
|
||||
"body": "zIndex: ${1},",
|
||||
"description": "zIndex"
|
||||
},
|
||||
"api": {
|
||||
"prefix": "api",
|
||||
"body": [
|
||||
"import axios from 'axios';",
|
||||
"",
|
||||
"const api = axios.create({",
|
||||
" baseURL: ${1},",
|
||||
"});",
|
||||
"",
|
||||
"export default api;",
|
||||
""
|
||||
],
|
||||
"description": "Create Axios Configuration file"
|
||||
},
|
||||
"region": {
|
||||
"prefix": "region",
|
||||
"body": [
|
||||
"//#region ${1}",
|
||||
"${2}",
|
||||
"//#endregion"
|
||||
],
|
||||
"description": "Create region"
|
||||
},
|
||||
"regionStartEnd": {
|
||||
"prefix": "#regionStartEnd",
|
||||
"body": [
|
||||
"//#region ${1}",
|
||||
"${2}",
|
||||
"//#endregion"
|
||||
],
|
||||
"description": "Create region"
|
||||
}
|
||||
}
|
385
snippets/html/javascript/react-ts.json
Normal file
385
snippets/html/javascript/react-ts.json
Normal file
|
@ -0,0 +1,385 @@
|
|||
{
|
||||
"destructuring of props": {
|
||||
"prefix": "dp",
|
||||
"body": ["const { ${1:name} } = this.props"]
|
||||
},
|
||||
"destructuring of state": {
|
||||
"prefix": "ds",
|
||||
"body": ["const { ${1:name} } = this.state"]
|
||||
},
|
||||
"reactClassCompoment": {
|
||||
"prefix": "rcc",
|
||||
"body": "import React, { Component } from 'react'\n\nclass ${TM_FILENAME_BASE} extends Component {\n\trender () {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t$0\n\t\t\t</div>\n\t\t)\n\t}\n}\n\nexport default ${1}",
|
||||
"description": "Creates a React component class"
|
||||
},
|
||||
"reactJustClassCompoment": {
|
||||
"prefix": "rcjc",
|
||||
"body": "class ${TM_FILENAME_BASE} extends Component {\n\trender () {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t$0\n\t\t\t</div>\n\t\t)\n\t}\n}\n",
|
||||
"description": "Creates a React component class"
|
||||
},
|
||||
"reactClassCompomentPropTypes": {
|
||||
"prefix": "rccp",
|
||||
"body": "import React, { Component, PropTypes } from 'react'\n\nclass ${TM_FILENAME_BASE} extends Component {\n\trender () {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t$0\n\t\t\t</div>\n\t\t)\n\t}\n}\n\n${1}.propTypes = {\n\n}\n\nexport default ${1}",
|
||||
"description": "Creates a React component class with PropTypes"
|
||||
},
|
||||
"reactClassCompomentWithMethods": {
|
||||
"prefix": "rcfc",
|
||||
"body": "import React, { Component, PropTypes } from 'react'\n\nclass ${TM_FILENAME_BASE} extends Component {\n\tconstructor(props) {\n\t\tsuper(props)\n\n\t}\n\n\tcomponentWillMount () {\n\n\t}\n\n\tcomponentDidMount () {\n\n\t}\n\n\tcomponentWillReceiveProps (nextProps) {\n\n\t}\n\n\tshouldComponentUpdate (nextProps, nextState) {\n\n\t}\n\n\tcomponentWillUpdate (nextProps, nextState) {\n\n\t}\n\n\tcomponentDidUpdate (prevProps, prevState) {\n\n\t}\n\n\tcomponentWillUnmount () {\n\n\t}\n\n\trender () {\n\t\treturn (\n\t\t\t<div>\n\n\t\t\t</div>\n\t\t)\n\t}\n}\n\n${1}.propTypes = {\n\n}\n\nexport default ${1}",
|
||||
"description": "Creates a React component class with PropTypes and all lifecycle methods"
|
||||
},
|
||||
"reactFunctionComponent": {
|
||||
"prefix": "rfc",
|
||||
"body": "import React from 'react'\n\nexport const ${TM_FILENAME_BASE} = (props : {}) => {\n\treturn (\n\t\t<div>\n\t\t\t$0\n\t\t</div>\n\t)\n}",
|
||||
"description": "Creates a React functional component without PropTypes"
|
||||
},
|
||||
"reactFunctionComponentWithEmotion": {
|
||||
"prefix": "rfce",
|
||||
"body": "import { css } from '@emotion/core'\nimport React from 'react'\n\nexport const ${TM_FILENAME_BASE} = (props: {}) => {\n\treturn (\n\t\t<div css={css``}>\n\t\t\t$0\n\t\t</div>\n\t)\n}",
|
||||
"description": "Creates a React functional component with emotion import"
|
||||
},
|
||||
"classConstructor": {
|
||||
"prefix": "con",
|
||||
"body": "constructor (props) {\n\tsuper(props)\n\t$0\n}\n",
|
||||
"description": "Adds a default constructor for the class that contains props as arguments"
|
||||
},
|
||||
"classConstructorContext": {
|
||||
"prefix": "conc",
|
||||
"body": "constructor (props, context) {\n\tsuper(props, context)\n\t$0\n}\n",
|
||||
"description": "Adds a default constructor for the class that contains props and context as arguments"
|
||||
},
|
||||
"componentWillMount": {
|
||||
"prefix": "cwm",
|
||||
"body": "\ncomponentWillMount () {\n\t$0\n}\n",
|
||||
"description": "Invoked once, both on the client and server, immediately before the initial rendering occurs"
|
||||
},
|
||||
"componentDidMount": {
|
||||
"prefix": "cdm",
|
||||
"body": "componentDidMount () {\n\t$0\n}\n",
|
||||
"description": "Invoked once, only on the client (not on the server), immediately after the initial rendering occurs."
|
||||
},
|
||||
"componentWillReceiveProps": {
|
||||
"prefix": "cwr",
|
||||
"body": "componentWillReceiveProps (nextProps) {\n\t$0\n}\n",
|
||||
"description": "Invoked when a component is receiving new props. This method is not called for the initial render."
|
||||
},
|
||||
"componentGetDerivedStateFromProps": {
|
||||
"prefix": "cgd",
|
||||
"body": "\nstatic getDerivedStateFromProps(nextProps, prevState) {\n\t$0\n}\n",
|
||||
"description": "Invoked after a component is instantiated as well as when it receives new props. It should return an object to update state, or null to indicate that the new props do not require any state updates."
|
||||
},
|
||||
"shouldComponentUpdate": {
|
||||
"prefix": "scu",
|
||||
"body": "shouldComponentUpdate (nextProps, nextState) {\n\t$0\n}\n",
|
||||
"description": "Invoked before rendering when new props or state are being received. "
|
||||
},
|
||||
"componentWillUpdate": {
|
||||
"prefix": "cwup",
|
||||
"body": "componentWillUpdate (nextProps, nextState) {\n\t$0\n}\n",
|
||||
"description": "Invoked immediately before rendering when new props or state are being received."
|
||||
},
|
||||
"componentDidUpdate": {
|
||||
"prefix": "cdup",
|
||||
"body": "componentDidUpdate (prevProps, prevState) {\n\t$0\n}\n",
|
||||
"description": "Invoked immediately after the component's updates are flushed to the DOM."
|
||||
},
|
||||
"componentWillUnmount": {
|
||||
"prefix": "cwun",
|
||||
"body": "componentWillUnmount () {\n\t$0\n}\n",
|
||||
"description": "Invoked immediately before a component is unmounted from the DOM."
|
||||
},
|
||||
"componentRender": {
|
||||
"prefix": "ren",
|
||||
"body": "render () {\n\treturn (\n\t\t<div>\n\t\t\t$0\n\t\t</div>\n\t)\n}",
|
||||
"description": "When called, it should examine this.props and this.state and return a single child element."
|
||||
},
|
||||
"componentSetStateObject": {
|
||||
"prefix": "sst",
|
||||
"body": "this.setState($0)",
|
||||
"description": "Performs a shallow merge of nextState into current state"
|
||||
},
|
||||
"componentSetStateFunc": {
|
||||
"prefix": "ssf",
|
||||
"body": "this.setState((state, props) => { return { $0 }})\n",
|
||||
"description": "Performs a shallow merge of nextState into current state"
|
||||
},
|
||||
"componentProps": {
|
||||
"prefix": "tp",
|
||||
"body": "this.props.$0",
|
||||
"description": "Access component's props"
|
||||
},
|
||||
"componentState": {
|
||||
"prefix": "ts",
|
||||
"body": "this.state.$0",
|
||||
"description": "Access component's state"
|
||||
},
|
||||
"propTypes": {
|
||||
"prefix": "rpt",
|
||||
"body": "$1.propTypes = {\n\t$2\n}",
|
||||
"description": "Creates empty propTypes declaration"
|
||||
},
|
||||
"propTypeArray": {
|
||||
"prefix": "pta",
|
||||
"body": "PropTypes.array,",
|
||||
"description": "Array prop type"
|
||||
},
|
||||
"propTypeArrayRequired": {
|
||||
"prefix": "ptar",
|
||||
"body": "PropTypes.array.isRequired,",
|
||||
"description": "Array prop type required"
|
||||
},
|
||||
"propTypeBool": {
|
||||
"prefix": "ptb",
|
||||
"body": "PropTypes.bool,",
|
||||
"description": "Bool prop type"
|
||||
},
|
||||
"propTypeBoolRequired": {
|
||||
"prefix": "ptbr",
|
||||
"body": "PropTypes.bool.isRequired,",
|
||||
"description": "Bool prop type required"
|
||||
},
|
||||
"propTypeFunc": {
|
||||
"prefix": "ptf",
|
||||
"body": "PropTypes.func,",
|
||||
"description": "Func prop type"
|
||||
},
|
||||
"propTypeFuncRequired": {
|
||||
"prefix": "ptfr",
|
||||
"body": "PropTypes.func.isRequired,",
|
||||
"description": "Func prop type required"
|
||||
},
|
||||
"propTypeNumber": {
|
||||
"prefix": "ptn",
|
||||
"body": "PropTypes.number,",
|
||||
"description": "Number prop type"
|
||||
},
|
||||
"propTypeNumberRequired": {
|
||||
"prefix": "ptnr",
|
||||
"body": "PropTypes.number.isRequired,",
|
||||
"description": "Number prop type required"
|
||||
},
|
||||
"propTypeObject": {
|
||||
"prefix": "pto",
|
||||
"body": "PropTypes.object,",
|
||||
"description": "Object prop type"
|
||||
},
|
||||
"propTypeObjectRequired": {
|
||||
"prefix": "ptor",
|
||||
"body": "PropTypes.object.isRequired,",
|
||||
"description": "Object prop type required"
|
||||
},
|
||||
"propTypeString": {
|
||||
"prefix": "pts",
|
||||
"body": "PropTypes.string,",
|
||||
"description": "String prop type"
|
||||
},
|
||||
"propTypeStringRequired": {
|
||||
"prefix": "ptsr",
|
||||
"body": "PropTypes.string.isRequired,",
|
||||
"description": "String prop type required"
|
||||
},
|
||||
"propTypeNode": {
|
||||
"prefix": "ptnd",
|
||||
"body": "PropTypes.node,",
|
||||
"description": "Anything that can be rendered: numbers, strings, elements or an array"
|
||||
},
|
||||
"propTypeNodeRequired": {
|
||||
"prefix": "ptndr",
|
||||
"body": "PropTypes.node.isRequired,",
|
||||
"description": "Anything that can be rendered: numbers, strings, elements or an array required"
|
||||
},
|
||||
"propTypeElement": {
|
||||
"prefix": "ptel",
|
||||
"body": "PropTypes.element,",
|
||||
"description": "React element prop type"
|
||||
},
|
||||
"propTypeElementRequired": {
|
||||
"prefix": "ptelr",
|
||||
"body": "PropTypes.element.isRequired,",
|
||||
"description": "React element prop type required"
|
||||
},
|
||||
"propTypeInstanceOf": {
|
||||
"prefix": "pti",
|
||||
"body": "PropTypes.instanceOf($0),",
|
||||
"description": "Is an instance of a class prop type"
|
||||
},
|
||||
"propTypeInstanceOfRequired": {
|
||||
"prefix": "ptir",
|
||||
"body": "PropTypes.instanceOf($0).isRequired,",
|
||||
"description": "Is an instance of a class prop type required"
|
||||
},
|
||||
"propTypeEnum": {
|
||||
"prefix": "pte",
|
||||
"body": "PropTypes.oneOf(['$0']),",
|
||||
"description": "Prop type limited to specific values by treating it as an enum"
|
||||
},
|
||||
"propTypeEnumRequired": {
|
||||
"prefix": "pter",
|
||||
"body": "PropTypes.oneOf(['$0']).isRequired,",
|
||||
"description": "Prop type limited to specific values by treating it as an enum required"
|
||||
},
|
||||
"propTypeOneOfType": {
|
||||
"prefix": "ptet",
|
||||
"body": "PropTypes.oneOfType([\n\t$0\n]),",
|
||||
"description": "An object that could be one of many types"
|
||||
},
|
||||
"propTypeOneOfTypeRequired": {
|
||||
"prefix": "ptetr",
|
||||
"body": "PropTypes.oneOfType([\n\t$0\n]).isRequired,",
|
||||
"description": "An object that could be one of many types required"
|
||||
},
|
||||
"propTypeArrayOf": {
|
||||
"prefix": "ptao",
|
||||
"body": "PropTypes.arrayOf($0),",
|
||||
"description": "An array of a certain type"
|
||||
},
|
||||
"propTypeArrayOfRequired": {
|
||||
"prefix": "ptaor",
|
||||
"body": "PropTypes.arrayOf($0).isRequired,",
|
||||
"description": "An array of a certain type required"
|
||||
},
|
||||
"propTypeObjectOf": {
|
||||
"prefix": "ptoo",
|
||||
"body": "PropTypes.objectOf($0),",
|
||||
"description": "An object with property values of a certain type"
|
||||
},
|
||||
"propTypeObjectOfRequired": {
|
||||
"prefix": "ptoor",
|
||||
"body": "PropTypes.objectOf($0).isRequired,",
|
||||
"description": "An object with property values of a certain type required"
|
||||
},
|
||||
"propTypeShape": {
|
||||
"prefix": "ptsh",
|
||||
"body": "PropTypes.shape({\n\t$0\n}),",
|
||||
"description": "An object taking on a particular shape"
|
||||
},
|
||||
"propTypeShapeRequired": {
|
||||
"prefix": "ptshr",
|
||||
"body": "PropTypes.shape({\n\t$0\n}).isRequired,",
|
||||
"description": "An object taking on a particular shape required"
|
||||
},
|
||||
"jsx element": {
|
||||
"prefix": "j",
|
||||
"body": "<${1:elementName}>\n\t$0\n</${1}>",
|
||||
"description": "an element"
|
||||
},
|
||||
"jsx element self closed": {
|
||||
"prefix": "jc",
|
||||
"body": "<${1:elementName} />",
|
||||
"description": "an element self closed"
|
||||
},
|
||||
"jsx elements map": {
|
||||
"prefix": "jm",
|
||||
"body": "{${1:array}.map((item) => <${2:elementName} key={item.id}>\n\t$0\n</${2}>)}",
|
||||
"description": "an element self closed"
|
||||
},
|
||||
"jsx elements map with return": {
|
||||
"prefix": "jmr",
|
||||
"body": "{${1:array}.map((item) => {\n\treturn <${2:elementName} key={item.id}>\n\t$0\n</${2}>\n})}",
|
||||
"description": "an element self closed"
|
||||
},
|
||||
"jsx element wrap selection": {
|
||||
"prefix": "jsx wrap selection with element",
|
||||
"body": "<${1:elementName}>\n\t{$TM_SELECTED_TEXT}\n</${1}>",
|
||||
"description": "an element"
|
||||
},
|
||||
"useState": {
|
||||
"prefix": "us",
|
||||
"body": "const [${1:val}, set${2:setterName}] = useState(${3:defVal})",
|
||||
"description": "use state hook"
|
||||
},
|
||||
"useEffect": {
|
||||
"prefix": "ue",
|
||||
"body": ["useEffect(() => {", "\t$1", "}, [${3:dependencies}])$0"],
|
||||
"description": "React useEffect() hook"
|
||||
},
|
||||
"useEffect with cleanup": {
|
||||
"prefix": "uec",
|
||||
"body": [
|
||||
"useEffect(() => {",
|
||||
"\t$1",
|
||||
"\n\treturn () => {",
|
||||
"\t\t$2",
|
||||
"\t}",
|
||||
"}, [${3:dependencies}])$0"
|
||||
],
|
||||
"description": "React useEffect() hook with a cleanup function"
|
||||
},
|
||||
"createContext": {
|
||||
"prefix": "cc",
|
||||
"body": [
|
||||
"export const $1 = createContext<$2>(",
|
||||
"\t(null as any) as $2",
|
||||
")"
|
||||
],
|
||||
"description": "creates a react context"
|
||||
},
|
||||
"useContext": {
|
||||
"prefix": "uc",
|
||||
"body": ["const $1 = useContext($2)$0"],
|
||||
"description": "React useContext() hook"
|
||||
},
|
||||
"useRef": {
|
||||
"prefix": "ur",
|
||||
"body": ["const ${1:elName}El = useRef(null)$0"],
|
||||
"description": "React useRef() hook"
|
||||
},
|
||||
"useCallback": {
|
||||
"prefix": "ucb",
|
||||
"body": [
|
||||
"const ${1:memoizedCallback} = useCallback(",
|
||||
"\t() => {",
|
||||
"\t\t${2:doSomething}(${3:a}, ${4:b})",
|
||||
"\t},",
|
||||
"\t[${5:a}, ${6:b}],",
|
||||
")$0"
|
||||
],
|
||||
"description": "React useCallback() hook"
|
||||
},
|
||||
"useMemo": {
|
||||
"prefix": "ume",
|
||||
"body": [
|
||||
"const ${1:memoizedValue} = useMemo(() => ${2:computeExpensiveValue}(${3:a}, ${4:b}), [${5:a}, ${6:b}])$0"
|
||||
],
|
||||
"description": "React useMemo() hook"
|
||||
},
|
||||
"describeBlock": {
|
||||
"prefix": "desc",
|
||||
"body": [
|
||||
"describe('$1', () => {",
|
||||
" $0",
|
||||
"})",
|
||||
""
|
||||
],
|
||||
"description": "Testing `describe` block"
|
||||
},
|
||||
"testBlock": {
|
||||
"prefix": "test",
|
||||
"body": [
|
||||
"test('should $1', () => {",
|
||||
" $0",
|
||||
"})",
|
||||
""
|
||||
],
|
||||
"description": "Testing `test` block"
|
||||
},
|
||||
"itBlock": {
|
||||
"prefix": "tit",
|
||||
"body": [
|
||||
"it('should $1', () => {",
|
||||
" $0",
|
||||
"})",
|
||||
""
|
||||
],
|
||||
"description": "Testing `it` block"
|
||||
},
|
||||
"itAsyncBlock": {
|
||||
"prefix": "tita",
|
||||
"body": [
|
||||
"it('should $1', async () => {",
|
||||
" $0",
|
||||
"})",
|
||||
""
|
||||
],
|
||||
"description": "Testing async `it` block"
|
||||
}
|
||||
}
|
394
snippets/html/javascript/react.json
Normal file
394
snippets/html/javascript/react.json
Normal file
|
@ -0,0 +1,394 @@
|
|||
{
|
||||
"destructuring of props": {
|
||||
"prefix": "dp",
|
||||
"body": ["const { ${1:name} } = this.props"]
|
||||
},
|
||||
"destructuring of state": {
|
||||
"prefix": "ds",
|
||||
"body": ["const { ${1:name} } = this.state"]
|
||||
},
|
||||
"if falsy return null": {
|
||||
"prefix": "ifr",
|
||||
"body": "if (!${1:condition}) {\n\treturn null\n}"
|
||||
},
|
||||
"reactClassCompoment": {
|
||||
"prefix": "rcc",
|
||||
"body": "import { Component } from 'react'\n\nclass ${TM_FILENAME_BASE} extends Component {\n\trender () {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t$0\n\t\t\t</div>\n\t\t)\n\t}\n}\n\nexport default ${1}",
|
||||
"description": "Creates a React component class"
|
||||
},
|
||||
"reactJustClassCompoment": {
|
||||
"prefix": "rcjc",
|
||||
"body": "class ${TM_FILENAME_BASE} extends Component {\n\trender () {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t$0\n\t\t\t</div>\n\t\t)\n\t}\n}\n",
|
||||
"description": "Creates a React component class"
|
||||
},
|
||||
"reactClassCompomentPropTypes": {
|
||||
"prefix": "rccp",
|
||||
"body": "import { Component, PropTypes } from 'react'\n\nclass ${TM_FILENAME_BASE} extends Component {\n\trender () {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t$0\n\t\t\t</div>\n\t\t)\n\t}\n}\n\n${1}.propTypes = {\n\n}\n\nexport default ${1}",
|
||||
"description": "Creates a React component class with PropTypes"
|
||||
},
|
||||
"reactClassCompomentWithMethods": {
|
||||
"prefix": "rcfc",
|
||||
"body": "import { Component, PropTypes } from 'react'\n\nclass ${TM_FILENAME_BASE} extends Component {\n\tconstructor(props) {\n\t\tsuper(props)\n\n\t}\n\n\tcomponentWillMount () {\n\n\t}\n\n\tcomponentDidMount () {\n\n\t}\n\n\tcomponentWillReceiveProps (nextProps) {\n\n\t}\n\n\tshouldComponentUpdate (nextProps, nextState) {\n\n\t}\n\n\tcomponentWillUpdate (nextProps, nextState) {\n\n\t}\n\n\tcomponentDidUpdate (prevProps, prevState) {\n\n\t}\n\n\tcomponentWillUnmount () {\n\n\t}\n\n\trender () {\n\t\treturn (\n\t\t\t<div>\n\n\t\t\t</div>\n\t\t)\n\t}\n}\n\n${1}.propTypes = {\n\n}\n\nexport default ${1}",
|
||||
"description": "Creates a React component class with PropTypes and all lifecycle methods"
|
||||
},
|
||||
"reactFunctionComponent": {
|
||||
"prefix": "rfc",
|
||||
"body": "\nconst ${TM_FILENAME_BASE} = () => {\n\treturn (\n\t\t<div>\n\t\t\t$0\n\t\t</div>\n\t)\n}\n\nexport default ${TM_FILENAME_BASE}",
|
||||
"description": "Creates a React function component without PropTypes"
|
||||
},
|
||||
"reactFunctionComponentWithCustomName": {
|
||||
"prefix": "rfcn",
|
||||
"body": "\nconst ${1:functionname} = () => {\n\treturn (\n\t\t<div>\n\t\t\t$0\n\t\t</div>\n\t)\n}\n\nexport default ${1:functionname}",
|
||||
"description": "Creates a React function component with custom name"
|
||||
},
|
||||
"reactFunctionComponentWithEmotion": {
|
||||
"prefix": "rfce",
|
||||
"body": "import { css } from '@emotion/core'\n\nexport const ${TM_FILENAME_BASE} = () => {\n\treturn (\n\t\t<div css={css``}>\n\t\t\t$0\n\t\t</div>\n\t)\n}",
|
||||
"description": "Creates a React functional component with emotion"
|
||||
},
|
||||
"reactStatelessProps": {
|
||||
"prefix": "rfcp",
|
||||
"body": "import { PropTypes } from 'react'\n\nconst ${TM_FILENAME_BASE} = props => {\n\treturn (\n\t\t<div>\n\t\t\t\n\t\t</div>\n\t)\n}\n\n${1}.propTypes = {\n\t$0\n}\n\nexport default ${1}",
|
||||
"description": "Creates a React function component with PropTypes"
|
||||
},
|
||||
"classConstructor": {
|
||||
"prefix": "con",
|
||||
"body": "constructor (props) {\n\tsuper(props)\n\t$0\n}\n",
|
||||
"description": "Adds a default constructor for the class that contains props as arguments"
|
||||
},
|
||||
"classConstructorContext": {
|
||||
"prefix": "conc",
|
||||
"body": "constructor (props, context) {\n\tsuper(props, context)\n\t$0\n}\n",
|
||||
"description": "Adds a default constructor for the class that contains props and context as arguments"
|
||||
},
|
||||
"componentWillMount": {
|
||||
"prefix": "cwm",
|
||||
"body": "\ncomponentWillMount () {\n\t$0\n}\n",
|
||||
"description": "Invoked once, both on the client and server, immediately before the initial rendering occurs"
|
||||
},
|
||||
"componentDidMount": {
|
||||
"prefix": "cdm",
|
||||
"body": "componentDidMount () {\n\t$0\n}\n",
|
||||
"description": "Invoked once, only on the client (not on the server), immediately after the initial rendering occurs."
|
||||
},
|
||||
"componentWillReceiveProps": {
|
||||
"prefix": "cwr",
|
||||
"body": "componentWillReceiveProps (nextProps) {\n\t$0\n}\n",
|
||||
"description": "Invoked when a component is receiving new props. This method is not called for the initial render."
|
||||
},
|
||||
"componentGetDerivedStateFromProps": {
|
||||
"prefix": "cgd",
|
||||
"body": "\nstatic getDerivedStateFromProps(nextProps, prevState) {\n\t$0\n}\n",
|
||||
"description": "Invoked after a component is instantiated as well as when it receives new props. It should return an object to update state, or null to indicate that the new props do not require any state updates."
|
||||
},
|
||||
"shouldComponentUpdate": {
|
||||
"prefix": "scu",
|
||||
"body": "shouldComponentUpdate (nextProps, nextState) {\n\t$0\n}\n",
|
||||
"description": "Invoked before rendering when new props or state are being received. "
|
||||
},
|
||||
"componentWillUpdate": {
|
||||
"prefix": "cwup",
|
||||
"body": "componentWillUpdate (nextProps, nextState) {\n\t$0\n}\n",
|
||||
"description": "Invoked immediately before rendering when new props or state are being received."
|
||||
},
|
||||
"componentDidUpdate": {
|
||||
"prefix": "cdup",
|
||||
"body": "componentDidUpdate (prevProps, prevState) {\n\t$0\n}\n",
|
||||
"description": "Invoked immediately after the component's updates are flushed to the DOM."
|
||||
},
|
||||
"componentWillUnmount": {
|
||||
"prefix": "cwun",
|
||||
"body": "componentWillUnmount () {\n\t$0\n}\n",
|
||||
"description": "Invoked immediately before a component is unmounted from the DOM."
|
||||
},
|
||||
"componentRender": {
|
||||
"prefix": "ren",
|
||||
"body": "render () {\n\treturn (\n\t\t<div>\n\t\t\t$0\n\t\t</div>\n\t)\n}",
|
||||
"description": "When called, it should examine this.props and this.state and return a single child element."
|
||||
},
|
||||
"componentSetStateObject": {
|
||||
"prefix": "sst",
|
||||
"body": "this.setState($0)",
|
||||
"description": "Performs a shallow merge of nextState into current state"
|
||||
},
|
||||
"componentSetStateFunc": {
|
||||
"prefix": "ssf",
|
||||
"body": "this.setState((state, props) => { return { $0 }})\n",
|
||||
"description": "Performs a shallow merge of nextState into current state"
|
||||
},
|
||||
"componentProps": {
|
||||
"prefix": "tp",
|
||||
"body": "this.props.$0",
|
||||
"description": "Access component's props"
|
||||
},
|
||||
"componentState": {
|
||||
"prefix": "ts",
|
||||
"body": "this.state.$0",
|
||||
"description": "Access component's state"
|
||||
},
|
||||
"propTypes": {
|
||||
"prefix": "rpt",
|
||||
"body": "$1.propTypes = {\n\t$2\n}",
|
||||
"description": "Creates empty propTypes declaration"
|
||||
},
|
||||
"propTypeArray": {
|
||||
"prefix": "pta",
|
||||
"body": "PropTypes.array,",
|
||||
"description": "Array prop type"
|
||||
},
|
||||
"propTypeArrayRequired": {
|
||||
"prefix": "ptar",
|
||||
"body": "PropTypes.array.isRequired,",
|
||||
"description": "Array prop type required"
|
||||
},
|
||||
"propTypeBool": {
|
||||
"prefix": "ptb",
|
||||
"body": "PropTypes.bool,",
|
||||
"description": "Bool prop type"
|
||||
},
|
||||
"propTypeBoolRequired": {
|
||||
"prefix": "ptbr",
|
||||
"body": "PropTypes.bool.isRequired,",
|
||||
"description": "Bool prop type required"
|
||||
},
|
||||
"propTypeFunc": {
|
||||
"prefix": "ptf",
|
||||
"body": "PropTypes.func,",
|
||||
"description": "Func prop type"
|
||||
},
|
||||
"propTypeFuncRequired": {
|
||||
"prefix": "ptfr",
|
||||
"body": "PropTypes.func.isRequired,",
|
||||
"description": "Func prop type required"
|
||||
},
|
||||
"propTypeNumber": {
|
||||
"prefix": "ptn",
|
||||
"body": "PropTypes.number,",
|
||||
"description": "Number prop type"
|
||||
},
|
||||
"propTypeNumberRequired": {
|
||||
"prefix": "ptnr",
|
||||
"body": "PropTypes.number.isRequired,",
|
||||
"description": "Number prop type required"
|
||||
},
|
||||
"propTypeObject": {
|
||||
"prefix": "pto",
|
||||
"body": "PropTypes.object,",
|
||||
"description": "Object prop type"
|
||||
},
|
||||
"propTypeObjectRequired": {
|
||||
"prefix": "ptor",
|
||||
"body": "PropTypes.object.isRequired,",
|
||||
"description": "Object prop type required"
|
||||
},
|
||||
"propTypeString": {
|
||||
"prefix": "pts",
|
||||
"body": "PropTypes.string,",
|
||||
"description": "String prop type"
|
||||
},
|
||||
"propTypeStringRequired": {
|
||||
"prefix": "ptsr",
|
||||
"body": "PropTypes.string.isRequired,",
|
||||
"description": "String prop type required"
|
||||
},
|
||||
"propTypeNode": {
|
||||
"prefix": "ptnd",
|
||||
"body": "PropTypes.node,",
|
||||
"description": "Anything that can be rendered: numbers, strings, elements or an array"
|
||||
},
|
||||
"propTypeNodeRequired": {
|
||||
"prefix": "ptndr",
|
||||
"body": "PropTypes.node.isRequired,",
|
||||
"description": "Anything that can be rendered: numbers, strings, elements or an array required"
|
||||
},
|
||||
"propTypeElement": {
|
||||
"prefix": "ptel",
|
||||
"body": "PropTypes.element,",
|
||||
"description": "React element prop type"
|
||||
},
|
||||
"propTypeElementRequired": {
|
||||
"prefix": "ptelr",
|
||||
"body": "PropTypes.element.isRequired,",
|
||||
"description": "React element prop type required"
|
||||
},
|
||||
"propTypeInstanceOf": {
|
||||
"prefix": "pti",
|
||||
"body": "PropTypes.instanceOf($0),",
|
||||
"description": "Is an instance of a class prop type"
|
||||
},
|
||||
"propTypeInstanceOfRequired": {
|
||||
"prefix": "ptir",
|
||||
"body": "PropTypes.instanceOf($0).isRequired,",
|
||||
"description": "Is an instance of a class prop type required"
|
||||
},
|
||||
"propTypeEnum": {
|
||||
"prefix": "pte",
|
||||
"body": "PropTypes.oneOf(['$0']),",
|
||||
"description": "Prop type limited to specific values by treating it as an enum"
|
||||
},
|
||||
"propTypeEnumRequired": {
|
||||
"prefix": "pter",
|
||||
"body": "PropTypes.oneOf(['$0']).isRequired,",
|
||||
"description": "Prop type limited to specific values by treating it as an enum required"
|
||||
},
|
||||
"propTypeOneOfType": {
|
||||
"prefix": "ptet",
|
||||
"body": "PropTypes.oneOfType([\n\t$0\n]),",
|
||||
"description": "An object that could be one of many types"
|
||||
},
|
||||
"propTypeOneOfTypeRequired": {
|
||||
"prefix": "ptetr",
|
||||
"body": "PropTypes.oneOfType([\n\t$0\n]).isRequired,",
|
||||
"description": "An object that could be one of many types required"
|
||||
},
|
||||
"propTypeArrayOf": {
|
||||
"prefix": "ptao",
|
||||
"body": "PropTypes.arrayOf($0),",
|
||||
"description": "An array of a certain type"
|
||||
},
|
||||
"propTypeArrayOfRequired": {
|
||||
"prefix": "ptaor",
|
||||
"body": "PropTypes.arrayOf($0).isRequired,",
|
||||
"description": "An array of a certain type required"
|
||||
},
|
||||
"propTypeObjectOf": {
|
||||
"prefix": "ptoo",
|
||||
"body": "PropTypes.objectOf($0),",
|
||||
"description": "An object with property values of a certain type"
|
||||
},
|
||||
"propTypeObjectOfRequired": {
|
||||
"prefix": "ptoor",
|
||||
"body": "PropTypes.objectOf($0).isRequired,",
|
||||
"description": "An object with property values of a certain type required"
|
||||
},
|
||||
"propTypeShape": {
|
||||
"prefix": "ptsh",
|
||||
"body": "PropTypes.shape({\n\t$0\n}),",
|
||||
"description": "An object taking on a particular shape"
|
||||
},
|
||||
"propTypeShapeRequired": {
|
||||
"prefix": "ptshr",
|
||||
"body": "PropTypes.shape({\n\t$0\n}).isRequired,",
|
||||
"description": "An object taking on a particular shape required"
|
||||
},
|
||||
"jsx element": {
|
||||
"prefix": "j",
|
||||
"body": "<${1:elementName}>\n\t$0\n</${1}>",
|
||||
"description": "an element"
|
||||
},
|
||||
"jsx element self closed": {
|
||||
"prefix": "jc",
|
||||
"body": "<${1:elementName} />",
|
||||
"description": "an element self closed"
|
||||
},
|
||||
"jsx elements map": {
|
||||
"prefix": "jm",
|
||||
"body": "{${1:array}.map((item) => <${2:elementName} key={item.id}>\n\t$0\n</${2}>)}",
|
||||
"description": "an element self closed"
|
||||
},
|
||||
"jsx elements map with return": {
|
||||
"prefix": "jmr",
|
||||
"body": "{${1:array}.map((item) => {\n\treturn <${2:elementName} key={item.id}>\n\t$0\n</${2}>\n})}",
|
||||
"description": "an element self closed"
|
||||
},
|
||||
"jsx element wrap selection": {
|
||||
"prefix": "jsx wrap selection with element",
|
||||
"body": "<${1:elementName}>\n\t{$TM_SELECTED_TEXT}\n</${1}>",
|
||||
"description": "an element"
|
||||
},
|
||||
"useState": {
|
||||
"prefix": "us",
|
||||
"body": "const [${1:setterName}, set${1:setterName}] = useState(${2:defVal})$0",
|
||||
"description": "use state hook"
|
||||
},
|
||||
"useEffect": {
|
||||
"prefix": "ue",
|
||||
"body": [
|
||||
"useEffect(() => {",
|
||||
"\t$1",
|
||||
"}, [${3:dependencies}])$0"
|
||||
],
|
||||
"description": "React useEffect() hook"
|
||||
},
|
||||
"useEffect with return": {
|
||||
"prefix": "uer",
|
||||
"body": [
|
||||
"useEffect(() => {",
|
||||
"\t$1",
|
||||
"\n\treturn () => {",
|
||||
"\t\t$2",
|
||||
"\t}",
|
||||
"}, [${3:dependencies}])$0"
|
||||
],
|
||||
"description": "React useEffect() hook with return statement"
|
||||
},
|
||||
"useContext": {
|
||||
"prefix": "uc",
|
||||
"body": ["const $1 = useContext($2)$0"],
|
||||
"description": "React useContext() hook"
|
||||
},
|
||||
"useRef": {
|
||||
"prefix": "ur",
|
||||
"body": ["const ${1:elName}El = useRef(null)$0"],
|
||||
"description": "React useContext() hook"
|
||||
},
|
||||
"useCallback": {
|
||||
"prefix": "ucb",
|
||||
"body": [
|
||||
"const ${1:memoizedCallback} = useCallback(",
|
||||
"\t() => {",
|
||||
"\t\t${2:doSomething}(${3:a}, ${4:b})",
|
||||
"\t},",
|
||||
"\t[${5:a}, ${6:b}],",
|
||||
")$0"
|
||||
],
|
||||
"description": "React useCallback() hook"
|
||||
},
|
||||
"useMemo": {
|
||||
"prefix": "ume",
|
||||
"body": [
|
||||
"const ${1:memoizedValue} = useMemo(() => ${2:computeExpensiveValue}(${3:a}, ${4:b}), [${5:a}, ${6:b}])$0"
|
||||
],
|
||||
"description": "React useMemo() hook"
|
||||
},
|
||||
"describeBlock": {
|
||||
"prefix": "desc",
|
||||
"body": [
|
||||
"describe('$1', () => {",
|
||||
" $0",
|
||||
"})",
|
||||
""
|
||||
],
|
||||
"description": "Testing `describe` block"
|
||||
},
|
||||
"testBlock": {
|
||||
"prefix": "test",
|
||||
"body": [
|
||||
"test('should $1', () => {",
|
||||
" $0",
|
||||
"})",
|
||||
""
|
||||
],
|
||||
"description": "Testing `test` block"
|
||||
},
|
||||
"itBlock": {
|
||||
"prefix": "tit",
|
||||
"body": [
|
||||
"it('should $1', () => {",
|
||||
" $0",
|
||||
"})",
|
||||
""
|
||||
],
|
||||
"description": "Testing `it` block"
|
||||
},
|
||||
"itAsyncBlock": {
|
||||
"prefix": "tita",
|
||||
"body": [
|
||||
"it('should $1', async () => {",
|
||||
" $0",
|
||||
"})",
|
||||
""
|
||||
],
|
||||
"description": "Testing async `it` block"
|
||||
}
|
||||
}
|
282
snippets/html/javascript/typescript.json
Normal file
282
snippets/html/javascript/typescript.json
Normal file
|
@ -0,0 +1,282 @@
|
|||
{
|
||||
"Constructor": {
|
||||
"prefix": "ctor",
|
||||
"body": [
|
||||
"/**",
|
||||
" *",
|
||||
" */",
|
||||
"constructor() {",
|
||||
"\tsuper();",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "Constructor"
|
||||
},
|
||||
"Class Definition": {
|
||||
"prefix": "class",
|
||||
"body": [
|
||||
"class ${1:name} {",
|
||||
"\tconstructor(${2:parameters}) {",
|
||||
"\t\t$0",
|
||||
"\t}",
|
||||
"}"
|
||||
],
|
||||
"description": "Class Definition"
|
||||
},
|
||||
"Interface Definition": {
|
||||
"prefix": "iface",
|
||||
"body": [
|
||||
"interface ${1:name} {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "Interface Definition"
|
||||
},
|
||||
"Public Method Definition": {
|
||||
"prefix": "public method",
|
||||
"body": [
|
||||
"/**",
|
||||
" * ${1:name}",
|
||||
" */",
|
||||
"public ${1:name}() {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "Public Method Definition"
|
||||
},
|
||||
"Private Method Definition": {
|
||||
"prefix": "private method",
|
||||
"body": [
|
||||
"private ${1:name}() {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "Private Method Definition"
|
||||
},
|
||||
"Import external module.": {
|
||||
"prefix": "import statement",
|
||||
"body": [
|
||||
"import { $0 } from \"${1:module}\";"
|
||||
],
|
||||
"description": "Import external module."
|
||||
},
|
||||
"Property getter": {
|
||||
"prefix": "get",
|
||||
"body": [
|
||||
"",
|
||||
"public get ${1:value}() : ${2:string} {",
|
||||
"\t${3:return $0}",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Property getter"
|
||||
},
|
||||
"Log to the console": {
|
||||
"prefix": "log",
|
||||
"body": [
|
||||
"console.log($1);",
|
||||
"$0"
|
||||
],
|
||||
"description": "Log to the console"
|
||||
},
|
||||
"Log warning to console": {
|
||||
"prefix": "warn",
|
||||
"body": [
|
||||
"console.warn($1);",
|
||||
"$0"
|
||||
],
|
||||
"description": "Log warning to the console"
|
||||
},
|
||||
"Log error to console": {
|
||||
"prefix": "error",
|
||||
"body": [
|
||||
"console.error($1);",
|
||||
"$0"
|
||||
],
|
||||
"description": "Log error to the console"
|
||||
},
|
||||
"Define a full property": {
|
||||
"prefix": "prop",
|
||||
"body": [
|
||||
"",
|
||||
"private _${1:value} : ${2:string};",
|
||||
"public get ${1:value}() : ${2:string} {",
|
||||
"\treturn this._${1:value};",
|
||||
"}",
|
||||
"public set ${1:value}(v : ${2:string}) {",
|
||||
"\tthis._${1:value} = v;",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Define a full property"
|
||||
},
|
||||
"Triple-slash reference": {
|
||||
"prefix": "ref",
|
||||
"body": [
|
||||
"/// <reference path=\"$1\" />",
|
||||
"$0"
|
||||
],
|
||||
"description": "Triple-slash reference"
|
||||
},
|
||||
"Property setter": {
|
||||
"prefix": "set",
|
||||
"body": [
|
||||
"",
|
||||
"public set ${1:value}(v : ${2:string}) {",
|
||||
"\tthis.$3 = v;",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Property setter"
|
||||
},
|
||||
"Throw Exception": {
|
||||
"prefix": "throw",
|
||||
"body": [
|
||||
"throw \"$1\";",
|
||||
"$0"
|
||||
],
|
||||
"description": "Throw Exception"
|
||||
},
|
||||
"For Loop": {
|
||||
"prefix": "for",
|
||||
"body": [
|
||||
"for (let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++) {",
|
||||
"\tconst ${3:element} = ${2:array}[${1:index}];",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "For Loop"
|
||||
},
|
||||
"For-Each Loop using =>": {
|
||||
"prefix": "foreach =>",
|
||||
"body": [
|
||||
"${1:array}.forEach(${2:element} => {",
|
||||
"\t$0",
|
||||
"});"
|
||||
],
|
||||
"description": "For-Each Loop using =>"
|
||||
},
|
||||
"For-In Loop": {
|
||||
"prefix": "forin",
|
||||
"body": [
|
||||
"for (const ${1:key} in ${2:object}) {",
|
||||
"\tif (${2:object}.hasOwnProperty(${1:key})) {",
|
||||
"\t\tconst ${3:element} = ${2:object}[${1:key}];",
|
||||
"\t\t$0",
|
||||
"\t}",
|
||||
"}"
|
||||
],
|
||||
"description": "For-In Loop"
|
||||
},
|
||||
"For-Of Loop": {
|
||||
"prefix": "forof",
|
||||
"body": [
|
||||
"for (const ${1:iterator} of ${2:object}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "For-Of Loop"
|
||||
},
|
||||
"Function Statement": {
|
||||
"prefix": "function",
|
||||
"body": [
|
||||
"function ${1:name}(${2:params}:${3:type}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "Function Statement"
|
||||
},
|
||||
"If Statement": {
|
||||
"prefix": "if",
|
||||
"body": [
|
||||
"if (${1:condition}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "If Statement"
|
||||
},
|
||||
"If-Else Statement": {
|
||||
"prefix": "ifelse",
|
||||
"body": [
|
||||
"if (${1:condition}) {",
|
||||
"\t$0",
|
||||
"} else {",
|
||||
"\t",
|
||||
"}"
|
||||
],
|
||||
"description": "If-Else Statement"
|
||||
},
|
||||
"New Statement": {
|
||||
"prefix": "new",
|
||||
"body": [
|
||||
"const ${1:name} = new ${2:type}(${3:arguments});$0"
|
||||
],
|
||||
"description": "New Statement"
|
||||
},
|
||||
"Switch Statement": {
|
||||
"prefix": "switch",
|
||||
"body": [
|
||||
"switch (${1:key}) {",
|
||||
"\tcase ${2:value}:",
|
||||
"\t\t$0",
|
||||
"\t\tbreak;",
|
||||
"",
|
||||
"\tdefault:",
|
||||
"\t\tbreak;",
|
||||
"}"
|
||||
],
|
||||
"description": "Switch Statement"
|
||||
},
|
||||
"While Statement": {
|
||||
"prefix": "while",
|
||||
"body": [
|
||||
"while (${1:condition}) {",
|
||||
"\t$0",
|
||||
"}"
|
||||
],
|
||||
"description": "While Statement"
|
||||
},
|
||||
"Do-While Statement": {
|
||||
"prefix": "dowhile",
|
||||
"body": [
|
||||
"do {",
|
||||
"\t$0",
|
||||
"} while (${1:condition});"
|
||||
],
|
||||
"description": "Do-While Statement"
|
||||
},
|
||||
"Try-Catch Statement": {
|
||||
"prefix": "trycatch",
|
||||
"body": [
|
||||
"try {",
|
||||
"\t$0",
|
||||
"} catch (${1:error}) {",
|
||||
"\t",
|
||||
"}"
|
||||
],
|
||||
"description": "Try-Catch Statement"
|
||||
},
|
||||
"Set Timeout Function": {
|
||||
"prefix": "settimeout",
|
||||
"body": [
|
||||
"setTimeout(() => {",
|
||||
"\t$0",
|
||||
"}, ${1:timeout});"
|
||||
],
|
||||
"description": "Set Timeout Function"
|
||||
},
|
||||
"Region Start": {
|
||||
"prefix": "#region",
|
||||
"body": [
|
||||
"//#region $0"
|
||||
],
|
||||
"description": "Folding Region Start"
|
||||
},
|
||||
"Region End": {
|
||||
"prefix": "#endregion",
|
||||
"body": [
|
||||
"//#endregion"
|
||||
],
|
||||
"description": "Folding Region End"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue