{
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": ["console.log('$1');", "$2"],
"description": "Log output to console"
},
"create Annotation": {
"prefix": "/**",
"body": [
"/**",
"* @Description",
"* @author xx",
"* @date ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
"*/"
],
"description": "创建注释"
},
"function": {
"prefix": "function 新建方法",
"body": "function ${1:name}() {${2}}",
"description": "方法"
},
"import": {
"prefix": "import 导入资源",
"body": "import {$0} from '';",
"description": "导入"
},
"js for": {
"prefix": "for",
"body": ["for(let i = 0; i < $1; i++) {", "}"],
"description": "js for"
},
"js for in": {
"prefix": "forin",
"body": ["for(let index in $1) {", "}"],
"description": "js for in"
},
"js for of": {
"prefix": "forof",
"body": ["for(let item of $1) {", "}"],
"description": "js for of"
},
"js forEach": {
"prefix": "forEach",
"body": [
"$1.forEach((data, index, array) => {",
" console.log(data, index, array);",
"});"
],
"description": "js forEach"
},
"math random": {
"prefix": "random",
"body": ["Math.round(Math.random() * $1)"],
"description": "math random"
}
}
VsCode Js代码片段
于 2023-05-30 10:38:42 首次发布