vscode中自定义代码块

2018-12-11  本文已影响0人  nzjcnjzx
{
    // 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.
    // Example:
    "Print to console": {
        "scope": "javascript,typescript",
        "prefix": "log",
        "body": [
            "console.log('$1');",
            "$2"
        ],
        "description": "Log output to console"
    },
    "for of ": {
        "scope": "javascript,typescript",
        "prefix": "fof",
        "body": [
            "for(let item of $1){"
                    ,"\t$2"
            ,"}"
        ],
        "description": "快速循环数组"
    }
}
(注意:创建哪种语言的代码片段就进相应语言的代码片段区域,写js代码段就不要把代码段写在了php的代码段编写区)

\r\n:代表换行,填写几个代表换几行,
\t:tab数,有几个代表有几个tab

上一篇 下一篇

猜你喜欢

热点阅读