3

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.

orkenstein
  • 2,810
  • 3
  • 24
  • 45

1 Answers1

1

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.

lawicko
  • 7,246
  • 3
  • 37
  • 49
  • Yep, looks like Uncrustify will not move the parameters to the new lines. After all, I ended up using Clang-Format + Xcode syntax re-indent with BBUncrustifyPlugin. Works in a much more predictable way. – orkenstein Jan 10 '15 at 09:04