作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我怎样才能让 clang 格式在 '<<' 和 '>>' 运算符上中断?
我尝试将 BreakBeforeBinaryOperators 设置为 All,但这在这里似乎没有任何区别。
我希望我的代码格式如下:
in >> a
>> b
>> c;
in >> a >> b >> c;
最佳答案
为此,您需要两个样式设置:
BreakBeforeBinaryOperators: All
ColumnLimit: 0
或者,将样式设置为预定义的
WebKit
style,它将为您设置这两个样式设置。
A column limit of 0 means that there is no column limit. In this case,clang-format will respect the input’s line breaking decisions withinstatements unless they contradict other rules.
in >> a >> b >> c;
不会被分成单独的行。>>
第一行的 >>
的后续行。它只是按通常的连续行数量缩进。例如,如果您的常规缩进是 4,您将得到:in >> a
>> b
>> c;
这其实有点奇怪,因为如果操作符是<<
, clang-format 将排列所有三个运算符。ColumnLimit
设置为 80 之类的其他值,以便其他行在合理的位置中断。关于c++ - 如何让 clang-format 在 << 和 >> 上中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56881048/
我是一名优秀的程序员,十分优秀!