VS code自定义用户代码片断snippet

打开VS code,“文件-首选项-用户代码片断-选择新建全局代码片断文件 “node

 

属性介绍:prefix   就是你自定义的快捷键服务器

      body    就是你自定义的代码片断ui

        description 就是这段代码的注释spa

 

 

demo : code

{
     "Print to console": {
         "prefix": "nodes",
         "body": [
             "const http = require('http')",
             "const server = http.createServer()",
             "server.on('request', (req, res) => {",
             "   console.log('我是node服务器')",
             "$1",
         "})",
         "server.listen(3000, () => {",
         "   console.log('server running at http://127.0.0.1:3000');",
         "})"
        ],
         "description": "node 服务器"
    }
}
相关文章
相关标签/搜索