-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang-format] Feature request: ability to break after (
/ before )
in control flow statements
#67738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I would also be interested in option that allows this style: for
(
someReallyLongInit;
someReallyLongPredicate;
someReallyLongStep
)
{
// ...
}
if
(
someReallyLongPredicate
)
{
// ...
}
// etc. I haven't seen any options for breaking the line before |
|
This behavior is kind of like #62963 It may be possible to add something like that for conditionals. Although that breaking of the function is not based on spilling over the line length. |
Introduce new options to allow for control of AlwaysBreak and BlockIndent selectively for If conditional statements (as currently supported), other conditional statements (for/while/switch), and other statements. Fixes llvm#67738. Fixes llvm#79176. Fixes llvm#80123.
Introduce new options to allow for control of AlwaysBreak and BlockIndent selectively for If conditional statements (as currently supported), other conditional statements (for/while/switch), and other statements. Fixes llvm#67738. Fixes llvm#79176. Fixes llvm#80123.
Introduce new options to allow for control of AlwaysBreak and BlockIndent selectively for If conditional statements (as currently supported), other conditional statements (for/while/switch), and other statements. Fixes llvm#67738. Fixes llvm#79176. Fixes llvm#80123.
Introduce new options to allow for control of AlwaysBreak and BlockIndent selectively for If conditional statements (as currently supported), other conditional statements (for/while/switch), and other statements. Fixes llvm#67738. Fixes llvm#79176. Fixes llvm#80123.
Introduce new options to allow for control of AlwaysBreak and BlockIndent selectively for If conditional statements (as currently supported), other conditional statements (for/while/switch), and other statements. Fixes llvm#67738. Fixes llvm#79176. Fixes llvm#80123.
Introduce new options to allow for control of AlwaysBreak and BlockIndent selectively for If conditional statements (as currently supported), other conditional statements (for/while/switch), and other statements. Fixes llvm#67738. Fixes llvm#79176. Fixes llvm#80123.
Introduce new style option to allow overriding the breaking after the opening parenthesis for control statements (if/for/while/switch). Fixes llvm#67738. Fixes llvm#79176. Fixes llvm#80123.
Introduce new style option to allow overriding the breaking after the opening parenthesis for control statements (if/for/while/switch). Fixes llvm#67738. Fixes llvm#79176. Fixes llvm#80123.
Introduce new options to allow for control of AlwaysBreak and BlockIndent selectively for If conditional statements (as currently supported), other conditional statements (for/while/switch), and other statements. Fixes llvm#67738. Fixes llvm#79176. Fixes llvm#80123.
Introduce new style option to allow overriding the breaking after the opening parenthesis for control statements (if/for/while/switch). Fixes llvm#67738. Fixes llvm#79176. Fixes llvm#80123.
After searching the clang-format style options webpage, I found no option to break after an opening parenthesis or before a closing one in control flow statements (
if
/for
/while
/do while
), I was hoping to be able to have a format like thisThe closest setting I could find was
AlignAfterOpenBracket
withBlockIndent
, but that only applies to function invocations, not control flow statements (the documentation does not mention anything about it being specific to function calls, it might be worth noting that).This formatting setting is available in IntelliJ IDEs (which I have used, hence me hoping I could find it in clang-format!), under File | Settings | Editor | Code Style | [language] | Wrapping and Braces, it has separate settings for
for
/if
/while
/do while
statements (and for Java also has one for thetry-with-resources
statement) allowing to "Do not wrap", "Wrap if long", "Chop down if long" and "Wrap always" which control the behaviour of the parentheses and also breaking on the init/cond/iter step in the case offor
, or breaking on&&
s and||
s in anif
/while
.The text was updated successfully, but these errors were encountered: