vscode c++ 保存时进行代码格式化

vscode是很好的编辑器,一般需要保存时进行代码格式化。

一般需要如下配置

//需要保存时进行格式化
"editor.formatOnSave": true,
//需要配置tab对应的空格键时
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.detectIndentation": false,
//用astyle进行c++代码格式化
"astyle.additional_languages": [
    "c",
    "cpp",
],
"astyle.cmd_options": [
    "--style=google", //风格格式和缩进
    "--indent=spaces=4", //缩进4个空格
    "--convert-tabs",
    "--align-pointer=name",
    "--align-reference=name",
    "--keep-one-line-statements",
    "--pad-header",
    "--pad-oper", //操作符两端插入一个空格
],

你可能感兴趣的:(C++,vscode)