- 下载astyle 下载地址
- windows平台
2.11 mdk 格式化单个文件
!E // 输入参数
2.12 mdk格式化所有文件
"$E*.c" "$E*.h" // 所有.c .h 文件
2.21 mdk中加vscode
!E // 输入参数
2.31 mdk 中加rt smart config 日本瑞萨公司配置工具
$P //initial Folder
--device $D --compiler ARMv6 configuration.xml // 输入参数
- vsocde配置astyle
3.11 安装扩展插件Astyle formate-Astye
3.12 配置文件 additional setting.json
{
"json.schemas": [
],
"git.ignoreWindowsGit27Warning": true,
"window.zoomLevel": 1,
"editor.mouseWheelZoom": true,
"remote.SSH.remotePlatform": {
"alias": "linux"
},
"astyle.executable": "C:\\AStyle\\bin\\astyle.exe", //重点是这个,指明路径
"[cpp]": {
"editor.defaultFormatter": "chiehyu.vscode-astyle"
},
"[c]": {
"editor.defaultFormatter": "chiehyu.vscode-astyle"
}, //这个是插件安装好了就有的
"astyle.additional_languages": []
}
- linux平台
安装 apt install astyle
linux 下setting.josn配置文件
"astyle.executable": "/usr/bin/astyle",
"astyle.additional_languages": [
"h",
"hpp",
"c",
"cpp",
],
"[cpp]": {
"editor.defaultFormatter": "chiehyu.vscode-astyle"
},
"[c]": {
"editor.defaultFormatter": "chiehyu.vscode-astyle"
},
"[h]": {
"editor.defaultFormatter": "chiehyu.vscode-astyle"
},
"astyle.cmd_options": [
// "--style=allman", # 确定是否花括号对齐
"--indent=spaces=4",
"--convert-tabs",
"--align-pointer=name",
"--align-reference=name",
"--keep-one-line-statements",
"--pad-header",
"--pad-oper",
"--break-closing-braces",
]
- 其它