Skip to content

Instantly share code, notes, and snippets.

@16Yongjin
Created March 27, 2022 02:22
Show Gist options
  • Save 16Yongjin/48f3ffc7b84fb3ce7bc784b634ac1769 to your computer and use it in GitHub Desktop.
Save 16Yongjin/48f3ffc7b84fb3ce7bc784b634ac1769 to your computer and use it in GitHub Desktop.
vs code code snippets
{
"Node.js Require": {
"prefix": "rq",
"body": ["require($1)"],
"description": "require modules"
},
"ES6 import": {
"prefix": "imf",
"body": ["import { $2 } from $1"],
"description": "import modules"
},
"ES6 export default": {
"prefix": "ed",
"body": ["export default $1"],
"description": "export default modules"
},
"ES6 export const": {
"prefix": "ec",
"body": ["export const $1"],
"description": "export const modules"
},
"ES6 Arrow Function": {
"prefix": "af",
"body": ["($1) => {\n\t$2\n}"],
"description": "Arrow function"
},
"ES7 Async Arrow Function": {
"prefix": "aaf",
"body": ["async ($1) => {\n\t$2\n}"],
"description": "Async arrow function"
},
"module.exports": {
"prefix": "me",
"body": ["module.exports = $1"],
"description": "module.exports short key"
},
"console.log": {
"prefix": "cl",
"body": ["console.log($1)"],
"description": "console.log"
}
}
{
"Node.js Require": {
"prefix": "rq",
"body": ["require($1)"],
"description": "require modules"
},
"ES6 import": {
"prefix": "imf",
"body": ["import { $2 } from $1"],
"description": "import modules"
},
"ES6 export default": {
"prefix": "ed",
"body": ["export default $1"],
"description": "export default modules"
},
"ES6 export const": {
"prefix": "ec",
"body": ["export const $1"],
"description": "export const modules"
},
"ES6 Arrow Function": {
"prefix": "af",
"body": ["($1) => {\n\t$2\n}"],
"description": "Arrow function"
},
"ES7 Async Arrow Function": {
"prefix": "aaf",
"body": ["async ($1) => {\n\t$2\n}"],
"description": "Async arrow function"
},
"module.exports": {
"prefix": "me",
"body": ["module.exports = $1"],
"description": "module.exports short key"
},
"console.log": {
"prefix": "cl",
"body": ["console.log($1)"],
"description": "console.log"
},
"ES6 export all from current folder": {
"prefix": "ea",
"body": ["export * from './$1'"],
"description": "export * from './'"
}
}
{
// Place your snippets for typescriptreact here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Typescript React PureComponent": {
"prefix": "rpc",
"body": [
"import * as React from 'react'",
"",
"export class $1 extends React.PureComponent {",
"\trender() {",
"\t\treturn ($2);",
"}}"
],
"description": "Typescript React PureComponent"
},
"Typescript React Function Component": {
"prefix": "rh",
"body": [
"import React from 'react'",
"",
"interface ${TM_FILENAME_BASE}Props {",
"$1",
"}",
"",
"export const $TM_FILENAME_BASE: React.FC<${TM_FILENAME_BASE}Props> = ({$2}) => {",
"\t\treturn ($3);",
"}"
],
"description": "Typescript React Function Component"
},
"Toggle State": {
"prefix": "tog",
"body": ["this.setState(state => ({", "\topen: !state.open", "}));"],
"description": "toggle state"
},
"console.log": {
"prefix": "cl",
"body": ["console.log($1)"],
"description": "console.log"
},
"className={classnames()}": {
"prefix": "cc",
"body": ["className={classnames('$1')}"],
"description": "tailwind react stuff"
},
"Apollo Query Component": {
"prefix": "apq",
"body": [
"interface Props {",
" children: (data: QueryResult<$1, OperationVariables>) => JSX.Element;",
"}",
"",
"export class $2 extends React.PureComponent<Props> {",
" render() {",
" return (",
" <Query<$1> query={$3}>{x => this.props.children(x)}</Query>",
" );",
" }",
"}"
],
"description": "Apollo Query Component"
},
"ES6 import": {
"prefix": "imf",
"body": ["import { $2 } from $1"],
"description": "import modules"
},
"ES6 export default": {
"prefix": "ed",
"body": ["export default $1"],
"description": "export default modules"
},
"ES6 export const": {
"prefix": "ec",
"body": ["export const $1"],
"description": "export const modules"
},
"ES6 Arrow Function": {
"prefix": "af",
"body": ["($1) => {\n\t$2\n}"],
"description": "Arrow function"
},
"ES7 Async Arrow Function": {
"prefix": "aaf",
"body": ["async ($1) => {\n\t$2\n}"],
"description": "Async arrow function"
},
"ES6 export all from current folder": {
"prefix": "ea",
"body": ["export * from './$1'"],
"description": "export * from './'"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment