Linux VScode Astyle 配置
Astyle
linux 终端下安装 astyle :
sudo apt-get install astyle
安装 Astyle 插件
在 VS Extensions(Ctrl+Shift+S) 中搜索 Astyle , 并安装 Astyle.
在配置中进行配置
- 按下
Ctrl+Shift+P
- 输入选择
Preferences:Open Settings(JSON)
- 添加以下设置
"astyle.executable": "astyle",
// "astyle.astylerc": "${workspaceRoot}/.vscode/astylerc", //此处默认是```$HOME/.astylerc```(不填)
"astyle.additional_languages": [
"c",
"cpp",
],
"astyle.cmd_options": [
"--style=otbs",
"--indent=spaces=4",
"--convert-tabs",
"--align-pointer=name",
"--align-reference=name",
"--keep-one-line-statements",
"--pad-header",
"--pad-oper",
],//(命令可以自己选择)
使用 Astyle
使用 Ctrl+Shift+I
既可以格式化代码.
NOTE: 可能需要输入两次
Ctrl+Shift+I
命令