2014-09-26 61 views
3

我有以下代碼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配置correclty。

回答

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只會對齊它們結腸,如果他們已經在多行。

+0

是的,看起來像Uncrustify不會將參數移動到新行。畢竟,我最終使用了Clang-Format + Xcode語法重新縮進BBUncrustifyPlugin。以更可預測的方式工作。 – orkenstein 2015-01-10 09:04:17