i would like to see an option to format arguments and parameters a bit different.
at the moment if you have a function definition which doesn’t fit to the current line and all arguments fit to the next line clang-format prefers method (2):
e.g.
col limit 140:
(1) void FunctionName01234567890(const Argument& a1, const Argument& a2, const Argument& a3, const Argument& a4, const Argument& a5);
(2) void FunctionName01234567890(const Argument& a1, const Argument& a2, const Argument& a3, const Argument& a4, const Argument& a5, const Argument& a6);
(3) void FunctionName01234567890(const Argument& a1, const Argument& a2, const Argument& a3, const Argument& a4, const Argument& a5, const Argument& a6, const Argument& a7);
results in:
(1) void FunctionName01234567890(const Argument& a1, const Argument& a2, const Argument& a3, const Argument& a4, const Argument& a5);
(2) void FunctionName01234567890(
const Argument& a1, const Argument& a2, const Argument& a3, const Argument& a4, const Argument& a5, const Argument& a6);
(3) void FunctionName01234567890(const Argument& a1, const Argument& a2, const Argument& a3, const Argument& a4, const Argument& a5,
const Argument& a6, const Argument& a7);
i prefer (1) and (3) and i will never see (2). I would love to get this result:
(2b) void FunctionName01234567890(const Argument& a1, const Argument& a2, const Argument& a3, const Argument& a4, const Argument& a5,
const Argument& a6);
Q:
- is this just a matter of settings (penalties?)?
- if not, can somebody guide me to the place in the source where the decision is done if all parameters fit to one line? i would like to add an option for that behaviour.
Best regards
Tilo
my .clang-format settings