Last active
April 8, 2020 16:27
-
-
Save Luxcium/d39d576866f6039cea0661da1da24892 to your computer and use it in GitHub Desktop.
My main VSCode Snippets file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
// =====2020=====Luxcium=====Author==Benjamin=Vincent=(Luxcium)=License==MIT==== | |
{ | |
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | |
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | |
// is left empty or omitted, the snippet gets applied to all languages. 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. | |
"template_delimiters": { | |
"scope": "javascript,typescript", | |
"prefix": "`", | |
"body": "`$TM_SELECTED_TEXT$0`", | |
"description": "surround a template literal" | |
}, | |
"template_placeholder": { | |
"scope": "javascript,typescript", | |
"prefix": "$", | |
"body": "${$TM_SELECTED_TEXT$0}", | |
"description": "Template literals placeholder" | |
}, | |
"add_export_const": { | |
"scope": "javascript,typescript", | |
"prefix": "exc", | |
"body": "export const $TM_SELECTED_TEXT $1;", | |
"description": "adding keywords export const" | |
}, | |
"export_const_arrow": { | |
"scope": "javascript,typescript", | |
"prefix": "excf", | |
"body": "export const $TM_SELECTED_TEXT$1 = (${param}: ${type})=>{\n $0\n return ${param} ;\n}", | |
"description": "export const constName = ()=>{}" | |
}, | |
"Async_IIFE": { | |
"scope": "javascript,typescript", | |
"prefix": "aIIFE", | |
"body": [ | |
";(async () => {", | |
" //", | |
" $TM_SELECTED_TEXT$0", | |
"", | |
" return void 0;", | |
"})().catch(error =>console.log('error message:', error.message));" | |
], | |
"description": "Async IIFE template" | |
}, | |
"TRY_THROWB": { | |
"scope": "javascript,typescript", | |
"prefix": "TrThrow", | |
"body": [ | |
"try {", | |
"//", | |
" $TM_SELECTED_TEXT$0", | |
"} catch (e) {", | |
" console.error(e.message);", | |
" // throw new Error(e.message);", | |
"return void 0;", | |
"}" | |
], | |
"description": "Custom try catch block template" | |
}, | |
"AWAIT_PAREN": { | |
"scope": "javascript,typescript", | |
"prefix": "awt", | |
"body": "(await $TM_SELECTED_TEXT)$0", | |
"description": "encapsulate with await inside parenthesis" | |
}, | |
"CONSOLE_LOG": { | |
"scope": "javascript,typescript", | |
"prefix": "conl", | |
"body": "console.log($TM_SELECTED_TEXT$0)", | |
"description": "encapsulate with a console.log inside parenthesis" | |
}, | |
"function_template001": { | |
"scope": "typescript", | |
"prefix": "exportAsyncFunct", | |
"body": [ | |
"export const $functionName = $async ($param: any) => {", | |
"//", | |
"", | |
"$TM_SELECTED_TEXT$0", | |
"", | |
"//", | |
" return { param };", | |
"};", | |
"" | |
], | |
"description": "new export arrow function" | |
}, | |
"exrpot_template001": { | |
"scope": "javascript,typescript", | |
"prefix": "exf", | |
"body": "export { $1 } from './$1'$0;", | |
"description": "export element from same folder" | |
}, | |
"exrpot_template003": { | |
"scope": "javascript,typescript", | |
"prefix": "exff", | |
"body": "export { $1 } from './$1/$1'$0;", | |
"description": "export element from same folder" | |
}, | |
"exrpot_template004": { | |
"scope": "javascript,typescript", | |
"prefix": "ext", | |
"body": "export type $0", | |
"description": "export type" | |
}, | |
"import_template001": { | |
"scope": "javascript,typescript", | |
"prefix": "imp", | |
"body": [ | |
"import { $2 } from '$1';$0", | |
"" | |
], | |
"description": "import element" | |
}, | |
"else_template001": { | |
"scope": "javascript,typescript", | |
"prefix": "else}", | |
"body": [ | |
"}else{", | |
" //", | |
"", | |
"$TM_SELECTED_TEXT$0", | |
"", | |
], | |
"description": "else statement " | |
}, | |
"else_template002": { | |
"scope": "javascript,typescript", | |
"prefix": "else", | |
"body": [ | |
"else{", | |
" //", | |
"", | |
"$TM_SELECTED_TEXT$0", | |
"}", | |
], | |
"description": "else statement " | |
} | |
} | |
// =====2020=====Luxcium=====Author==Benjamin=Vincent=(Luxcium)=License==MIT==== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIT LICENSE | |
Copyright (c) 2020 Benjamin Vincent Kasapoglu (Luxcium) | |
Permission is hereby granted, free of charge, to all person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | |
of the Software, and to permit persons to whom the Software is furnished to do | |
so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all | |
copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ALL KIND, EXPRESS OR | |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ALL CLAIM, DAMAGES OR | |
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
DEALINGS IN THE SOFTWARE. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment