1. 安装插件 Clang-Format
2. 安装 clang-format
如, centos9 :
sudo yum install git-clang-format
3. 添加配置
如:
{
"clang-format.language.proto.style": "{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0, AlignConsecutiveAssignments: true, AlignConsecutiveAssignments: true}",
"clang-format.language.proto.fallbackStyle": "google",
"clang-format.language.proto.enable": true,
"clang-format.style": "{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0, AlignConsecutiveAssignments: true, AlignConsecutiveAssignments: true}",
"[proto3]": {
"editor.defaultFormatter": "xaver.clang-format"
}
}