orkenstein
orkenstein

Reputation: 2858

Xcode with uncrustify: how to align function declaration to colons?

I have the following code:

@interface TRYoutubeManager : AFHTTPRequestOperationManager

- (void)getVideosForDefaultChannelsWithSuccess:(void (^)(NSArray *youtubeVideosArray))successBlock failure:(void (^)(NSError *error))failureBlock;

@end

So I want to preserve 120 characters line limit. And align declaration on colons, like this:

@interface TRYoutubeManager : AFHTTPRequestOperationManager

- (void)getVideosForDefaultChannelsWithSuccess:(void (^)(NSArray *youtubeVideosArray))successBlock
                                       failure:(void (^)(NSError *error))failureBlock;

@end

But when I apply Uncrustify on it, I get:

@interface TRYoutubeManager : AFHTTPRequestOperationManager

- (void)getVideosForDefaultChannelsWithSuccess:(void (^)(NSArray *youtubeVideosArray))successBlock failure:(void (^)(
                                                                                                                     NSError *
                                                                                                                     error))
failureBlock;

@end

Plugin spoils the whole thing. Even line limit exceeded. Here it is some critical (I guess) params:

# Align ObjC declaration params on colon
align_oc_decl_colon                     = true          # 
# Alignment span for ObjC message colons
align_oc_msg_colon_span                 = 20            # number

# Alignment span for ObjC message spec
align_oc_msg_spec_span                  = 0             # number
# Code width
code_width                              = 120           # number

The whole config file HERE

Please, help me to setup Uncrustify config correclty.

Upvotes: 3

Views: 759

Answers (1)

lawicko
lawicko

Reputation: 7344

Have you tried looking into those:

nl_oc_msg_leave_one_liner                 { False, True }   Don't
split one-line OC messages

nl_oc_msg_args                            { False, True }   Whether to
put each OC message parameter on a separate line   See
nl_oc_msg_leave_one_liner

I don't think the formatter will actually move the parameters in the declaration to the new lines for you, the align_oc_decl_colon will only align them to colon if they already are in multiple lines.

Upvotes: 1

Related Questions