Control line breaks of clang-format Objective-C argument

I am trying to figure out how to prevent clang-format from adding line breaks when there is a block as an argument.

For example, I want:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(500 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ NSLog(@"here"); }); 

Not this:

 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(500 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ NSLog(@"here"); }); 

To throw the key into things, I also want some block arguments to be broken, for example:

 [self method:argument success:^(NSString* result) { // Do stuff } failure:^(NSError *error) { // Do other stuff } 

Can someone help me figure this out? Is this possible with clang-format?

My .clang-format

+6
source share

Source: https://habr.com/ru/post/987947/


All Articles