I'm trying to achieve the following format for short functions:
void shortFunctionDecl(int x, int y) {
// ...
}
But if the line is too long, I would like it to overflow like this (and not bin pack the arguments)
void longerFunctionDecl(
int longName,
int longName2,
int longName3
) { // I would also be ok if the paren were on the previous line and the brace on this one
// ...
}
Currently code ends up like this and it's annoying to read
void longerFunctionDecl(
int longName,
int longName2,
int longName3) {
// code is at the same indentation level as the args, hard to read.
}
I've been trying to place around with some of the BraceWrapping settings but it looks like there are only Multiline settings for control statements. Is it possible to do what I want in clang-format? FWIW, it seems like the parenthesis breaks are not possible but I wonder if the brace breaks might be? Really not sure.
Here's my .clang-format file. I've marked the relevant section, but included the entire thing for completeness.
BasedOnStyle: Google
IndentWidth: 4
TabWidth: 4
UseTab: Always
ColumnLimit: 120
AccessModifierOffset: -3
# Relevant portion:
AllowShortFunctionsOnASingleLine: None
BinPackArguments: false
BinPackParameters: false
AlignAfterOpenBracket: AlwaysBreak
AllowAllArgumentsOnNextLine: false