如何在 VS Code 中自定义多个片段?

Eve*_*Eve 3 visual-studio-code vscode-settings

我在 VS 代码中自定义了一个片段。代码如下:

"angular2-logger": {
    "prefix": "log",
    "body": [
        "this.log.log('$1');"
    ],
    "description": "??angular2-logger?log??"
}
Run Code Online (Sandbox Code Playgroud)

但是如果想添加更多片段怎么办?谁能给我一个演示?

Chi*_*ali 5

只需在括号后添加一个逗号并创建下一个片段。

例如:

"angular2-logger": {
    "prefix": "log",
    "body": [
        "this.log.log('$1');"
    ],
    "description": "??angular2-logger?log??"
},
"Console.log": {
  "prefix": "log",
  "body": [
    "console.log($1);"
  ],
  "description": "Console.log"
}
Run Code Online (Sandbox Code Playgroud)