clang-format and functions: always add new line after open parenthesis when closing parenthesis is in new line

Viewed 56

I've managed to achieve following output after using clang-format:

void doSomethingBlaBlaBla(
    very::looooooooooooong::Type veryLongParamNameThatExceedsColumnLimitIfPutAbove
) override;

Meaning that if such line:

void doSomethingBlaBlaBla(very::looooooooooooong::Type veryLongParamNameThatExceedsColumnLimitIfPutAbove) override;

exceeds ColumnLimit, it's being broken like you see above. But I can see that in corner cases clang would handle it differently - where corner case is that this exceeds ColumnLimit:

void doSomethingBlaBlaBla(very::looong::Type veryLongParamNameThatExceedsColumnLimitIfPutAbove) override;

but this alone (note lack of ) override;) doesn't:

void doSomethingBlaBlaBla(very::looong::Type veryLongParamNameThatExceedsColumnLimitIfPutAbove

In such case, clang formats it in a following manner:

void doSomethingBlaBlaBla(very::looong::Type veryLongParamNameThatExceedsColumnLimitIfPutAbove
) override;

It doesn't break line after opening parenthesis, but breaks it before closing one. Is there a config option that would break line after opening parenthesis in this situation?

This is my clang-format so far:

BasedOnStyle: Microsoft
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AllowShortLambdasOnASingleLine: None
BinPackArguments: false
BinPackParameters: false
BraceWrapping: 
  AfterClass: true
  AfterNamespace: false
  AfterControlStatement: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: AfterColon
ColumnLimit: 100
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DeriveLineEnding: false
DerivePointerAlignment: true
ExperimentalAutoDetectBinPacking: true
MaxEmptyLinesToKeep: 2
SortIncludes: false
SpaceAfterTemplateKeyword: false
SpaceBeforeCtorInitializerColon: false
SpaceBeforeInheritanceColon: false
SpaceBeforeRangeBasedForLoopColon: false
UseCRLF: true
ReflowComments: false
AlwaysBreakTemplateDeclarations: Yes
DeriveLineEnding: true
AllowAllArgumentsOnNextLine: false
...
0 Answers
Related