Open
Description
Description
When using clang-format v18.0 with the following minimum config:
---
AlignAfterOpenBracket: BlockIndent
IndentWidth: 2
ContinuationIndentWidth: 2
ColumnLimit: 80
Breaking if-statements which are longer than the column limit won't work. I found out, that BlockIndent
seems to be broken for if-statements when ContinuationIndentWidth < 4
.
Seems to be (slightly) related to: #28052
Input
And I try to format the following if statement:
if ( name== "ABCDE" || name == "ASDASD" || name == "asldmald" || name == "someverylong" || name == "break this" || name == "abcde") {
callthismethod();
alsoassignthis = 24;
}
Current output
clang-format correctly formats everything except for breaking the if statement with BlockIndent
:
if (name == "ABCDE" || name == "ASDASD" || name == "asldmald" || name == "someverylong" || name == "break this" || name == "abcde") {
callthismethod();
alsoassignthis = 24;
}
Expected output:
if (
name == "ABCDE" || name == "ASDASD" || name == "asldmald"
|| name == "someverylong" || name == "break this" || name == "abcde"
) {
callthismethod();
alsoassignthis = 24;
}
Comment: I don't mind where the ||
operators go, even though I'd prefer the math-style of breaking before it.
Any way to achieve this?