-
vscode安装插件macros image.png
-
打开vscode配置文件. 目录C:\Users[你的用户名]\AppData\Roaming\Code\User image.png
-
修改文件keybindings.json监听快捷键ctrl+shift+enter, 触发插件macros的自定义命令macros.end_semicolon
{
"key": "ctrl+shift+enter",
"command": "macros.end_semicolon",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+shift+enter",
"command": "macros.end_semicolon",
"when": "editorTextFocus && !editorReadonly && !suggestWidgetVisible"
}
- 修改settings.json配置插件macros的自定义命令macros.end_semicolon
// 末尾加分号
"macros": {
"end_semicolon": [
"editor.action.formatDocument",
"cursorLineEnd",
{
"command": "type",
"args": {
"text": ";"
}
},
],
}
5. 效果如图