VSCode 自动添加版权信息
操作步骤:
Ctrl + Shift + P -> Preferences: Configure User Snippets -> New Global Snippets file...
输入任意名称回车后,自动生成如下模板:
{
// Place your global 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"
// }
}
比如我希望输入cpr之后直接输出如下内容,并且光标自动跳转到 description: 位置
/**
*@description:
*@author: Zijian TENG
*@date: 2021-03-11
*/
则应该这么修改:
{
"Print to console": {
"prefix": "cpr",
"body": [
"/**",
" *@description: $1", // 按一下 tab 自动跳转到这里
" *@author: Zijian TENG",
" *@date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}",
" */",
""
],
"description": "copyright snippets"
}
}
2025-03-17 09:27:56【出处】:https://www.cnblogs.com/tengzijian/p/vscode-auto-complete-code-snippets.html
=======================================================================================
如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的【关注我】。(●'◡'●)
因为,我的写作热情也离不开您的肯定与支持,感谢您的阅读,我是【Jack_孟】!
本文来自博客园,作者:jack_Meng,转载请注明原文链接:https://www.cnblogs.com/mq0036/p/18776179
【免责声明】本文来自源于网络,如涉及版权或侵权问题,请及时联系我们,我们将第一时间删除或更改!
浙公网安备 33010602011771号