Step 1 打开开发工具VsCode

请输入图片描述

Step 2 按F1,然后在出现的输入框中输入snippets

请输入图片描述

Step 3 选择对应语言

(如果没有该用第二种,首选项=》用户代码片段

mac 直接在Users/用户名/Library/Application Support/Code/User/snippets 新建对应语言的json文件)

请输入图片描述

Step 4 修改json 文件

例如: php

    {
    // Place your snippets for php 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"
    // }
    "func": {
        "prefix": "func",
        "body": ["function  xxx() {", "", "}"],
        "description": "function"
    },
    "rev": {
        "prefix": "rev",
        "body": ["return view();"],
        "description": "rev"
    },
    "Rot": {
        "prefix": "Rot",
        "body": ["Route::get('test', 'TestController@index')->name('test');"],
        "description": "Rot"
    },
    "des": {
        "prefix": "des",
        "body": [
            "/**",
            "  * ++++++++ ",
            "  * @auth rui.chen ",
            "  * @date 20220222 ",
            "  * @desc ",
            "  * +++++++++",
            "  **/  "
        ],
        "description": "des"
    }
}

保存json文件,尝试在所在语言的文件中输入代码片段简写

最后修改:2019 年 02 月 16 日 06 : 22 PM
如果觉得我的文章对你有用,请随意赞赏