vscode配置自定义代码片段指令
1、按住ctrl + shift + p,输入snippets
2、根据自己要配置的类型文件,如js、ts、vue等文件类型进行配置
3、进行自定义配置
我这里只配置了注释格式,实际可以根据自己的需求来设置
{
// Place your snippets for vue 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"
// }
"单行注释中文": {
// "scope": "javascript,typescript",
"prefix": "注释", //指令名称
"body": ["/** $1 */"], //输入指令出现的内容
"description": "单行注释中文"
}
}
效果: