[英]How to configure clang-fromat to avoid wrap the brace for enum
I have an enum like this:我有一个这样的枚举:
enum class Fruit {
Apple = 0,
Banana = 1
};
And the .clang-format configurations for the enum looks like this:枚举的 .clang 格式配置如下所示:
BreakBeforeBraces: Attach
AllowShortEnumsOnASingleLine: false
BraceWrapping:
AfterEnum: false
After applying clang-format, the brace is wrapped and the code become应用clang-format后,大括号被包裹,代码变成
enum class Fruit
{
Apple = 0,
Banana = 1
};
How to config clang-format to keep the enum's original format?如何配置 clang-format 以保持枚举的原始格式?
我认为你的文件有问题,如果BreakBeforeBraces
不是Custom
你就不能使用BraceWrapping
I think it's a bug.我认为这是一个错误。 It's currently been fixed here but they haven't release yet:
它目前已在此处修复,但尚未发布:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.