VSCode C/C++ code format
Download astyle
https://sourceforge.net/projects/astyle/files/astyle/astyle%203.1/
添加到系统环境变量
VSCode AStyle 插件安装
settings.json
"astyle.additional_languages": [
"c",
"cpp",
],
"astyle.cmd_options": [
"--style=google",
"--indent=spaces=2",
"--pad-oper",
"--keep-one-line-statements",
],
"astyle.executable": "D:/software/AStyle/bin/Astyle"
具体参数参考:http://astyle.sourceforge.net/astyle.html#_General_Information
Usage
- ctrl+shift+p -> Format Document
- shift+alt+f
- 右键 -> Format Document/Format Document With