ios - Xcode 与 uncrustify : how to align function declaration to colons?

标签 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

插件破坏了整个事情。甚至超过行数限制。 这是一些关键(我猜)参数:

# 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 与 uncrustify : how to align function declaration to colons?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26055099/

相关文章:

iphone - 如何在iOS SDK中获取LinkedIn连接/ friend /联系人?

ios - 委托(delegate)和方法没有理由不执行

iphone - viewDidLoad(), 加载 View ()

ios - 无法在 iOS 11 模拟器上获取群组文件夹

swift - 快速显示来自共享类的警报

ios - 在 iOS XCode 项目中管理大量目标预处理器宏

iOS - 如何仅在 Table 为空时增加 UITableView 第一行的高度?

iphone - Objective-C 有选择地从 plist 填充表;如果键等于

ios - 当通知超过 64 个限制时如何在 iOS 中安排更多本地通知

ios - 优化最新的 iPad Pro 模拟器