Xcode with uncrustify:如何将函数声明与冒号对齐?

时间:2014-09-26 08:19:25

标签: ios objective-c xcode uncrustify

我有以下代码

@interface TRYoutubeManager : AFHTTPRequestOperationManager

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

@end

所以我希望保留120个字符的行限制。并在冒号上对齐声明,如下所示:

@interface TRYoutubeManager : AFHTTPRequestOperationManager

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

@end

但是当我对它应用Uncrustify时,

@interface TRYoutubeManager : AFHTTPRequestOperationManager

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

@end

插件破坏了整个事情。甚至超出了线路限制。 这是一些关键(我猜)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

整个配置文件HERE

请帮我设置Uncrustify config correclty。

1 个答案:

答案 0 :(得分:1)

您是否尝试过调查这些:

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

我认为格式化程序实际上不会将声明中的参数移动到新行,align_oc_decl_colon只会将它们对齐冒号,如果它们已经在多行中。