san*_*a-p 4 visual-studio-code vscode-snippets
如何通过存储库与同事共享我的自定义片段?例如,共享javascript.json文件。
我知道它应该进入内部.vscode,但具体在哪里以及具体的配置是什么?
在工作区.vscode文件夹中创建一个带有扩展名的文件.code-snippets并将代码片段放入其中。您可以添加 ascope将代码片段限制为语言
.vscode/custom.code-snippets
{
// Place your workspace 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"
// }
"Print to console": {
"scope": "javascript,typescript",
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
776 次 |
| 最近记录: |