c++ - 在 if、for、while 语句之前和之后添加换行符,使用 clang 格式(Astyle 等效 --break-blocks)
问题描述
我一直在使用clang-format
Linux Kernel 存储库中可用的样式,我想根据自己的需要对其进行调整。我试图在 if、for 和 while 块之前和之后添加换行符。
虽然我从未使用过 Astyle,但它通过--break-blocks
标志实现了所需的行为
Astyle 文档中的一个示例
isFoo = true;
if (isFoo) {
bar();
} else {
anotherBar();
}
isBar = false;
变成:
isFoo = true;
if (isFoo) {
bar();
} else {
anotherBar();
}
isBar = false;
我搜索了 的文档,clang-format
但找不到可以实现相同样式的标志。
有没有办法使用 实现这种风格clang-format
?
解决方案
推荐阅读
- xcode - 如何在 macOS 10.14.4 Mojave 上使用 fink
- java - System.out.print 不显示客户数据
- javascript - 等待 serviceWorker 注册不返回激活的工作人员
- mysql - 如何使用“级联”删除用户并自动删除他的所有关系?
- visual-studio-code - VS Code:在顶部和底部面板之间来回切换的键盘快捷键?
- php - 在 php 中使用会话(本地存储)的购物车
- f# - F# SAFE 模板:如何将库添加到服务器?
- python - sqlite 提交不使用 python 更新保存更改?
- angular - 如何从许多延迟加载模块中全局缓存功能模块状态?
- java - 如何在heroku中找到网络服务路径?