Add a new clang-format style option ObjCBlockResetsIndent of type bool. It defaults to false.
When true, ObjC blocks resets indentation to that of its owner block.
The resetting behavior is often desirable, as it leaves more columns for the content of the ObjC block.
E.g. for an unformatted file test.m like this:
- (void)test { [self callAVeryVeryVeryVeryVeryVeryLongAsyncMethodWith:@"Some param" completionHandler:^() { [self callAnotherLongMethodHereWith:@"param"]; }]; }
The formatted result with ObjCBlockResetsIndent=false (or omitted) is this:
// clang-format -style='{BasedOnStyle: Google, ObjCBlockResetsIndent: false}' test.m // OR // clang-format -style='{BasedOnStyle: Google}' test.m - (void)test { [self callAVeryVeryVeryVeryVeryVeryLongAsyncMethodWith:@"Some param" completionHandler:^() { [self callAnotherLongMethodHereWith: @"param"]; }]; }
The formatted result with ObjCBlockResetsIndent=true is this:
// clang-format -style='{BasedOnStyle: Google, ObjCBlockResetsIndent: true}' test.m - (void)test { [self callAVeryVeryVeryVeryVeryVeryLongAsyncMethodWith:@"Some param" completionHandler:^() { [self callAnotherLongMethodHereWith:@"param"]; }]; }