我有以下代码:

@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

插件破坏了整个过程。超过了偶数行限制。
这是一些重要的(我想)参数:
# 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配置的正确性。

最佳答案

您是否尝试过研究以下内容:

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仅会将它们与冒号对齐。

关于ios - Xcode与Unrustify:如何将函数声明与冒号对齐?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26055099/

10-12 00:18
查看更多