英文:
Is there a way to format my c++ code using one key ";" in Visual Studio Code
问题
我想在我的代码行以 ;
结束时格式化我的代码,就像在Visual Studio中一样。
我尝试为 ;
创建一个快捷键绑定以保存文件,但我无法再次在我的代码中写入 ;
?
有没有一种方法可以做到这一点?
这是我用于 ;
键的 JSON 设置。
{
"key": ";",
"command": "editor.action.file.save"
}
英文:
I want to format my code when I end my line of code with ;
, like in Visual studio.
I tried to make a hotkey binding for the ;
to save the file but I couldn't writ the ;
in my code again?
Is there a way to do that?
This is my json
settings for the ;
key.
{
"key": ";",
"command": "editor.action.file.save"
}
答案1
得分: 2
Sure, here is the translated content:
使用type
命令
{
"key": ";",
"command": "runCommands",
"args": {
"commands": [
{ "command": "type",
"args": { "text": ";" }
},
"editor.action.file.save"
]
},
"when": "editorTextFocus"
}
英文:
use the type
command
{
"key": ";",
"command": "runCommands",
"args": {
"commands": [
{ "command": "type",
"args": { "text": ";" }
},
"editor.action.file.save"
]
},
"when": "editorTextFocus"
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论