I am having some trouble with clang-format and blocks. I'd like to maintain the following format for method invocation with trailing blocks:
[self presentViewController:alertController animated:YES completion:^{
NSLog(@"Output");
// Do something
}];
I have set ColumnLimit to 0, which works everywhere, but it has the side effect of not formatting anything within the block (if statements, other invocation, etc.). The only way to get code inside blocks formatted, that I can find, is to set ColumnLimit to > 0, however, even if I set it to something huge like 100000, it adds breaks to every argument, which I do not want:
[self presentViewController:alertController
animated:YES
completion:^{
NSLog(@"Output");
// Do something
}];
So, the combination I want is for code within blocks to be properly formatted while not touching anything else about the method invocation.
My clang-format config:
Language: Cpp
ColumnLimit: 0
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLoopsOnASingleLine: false
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
IndentWidth: 4
TabWidth: 4
UseTab: Never
PointerAlignment: Right
DerivePointerAlignment: false
ObjCSpaceAfterProperty: true
BreakBeforeBraces: Stroustrup
AllowShortIfStatementsOnASingleLine: false
BreakBeforeTernaryOperators: false
IndentCaseLabels: true
AllowShortCaseLabelsOnASingleLine: false
AlignTrailingComments: true
BinPackParameters: false
BinPackArguments: false
AllowShortFunctionsOnASingleLine: false
IndentWrappedFunctionNames: false
ObjCSpaceBeforeProtocolList: true
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
SpacesBeforeTrailingComments: 1
ObjCBlockIndentWidth: 4
Clang format version is 3.6.
Any help would be great, not sure if this is possible to achieve.