问题描述
我想使用 uncrustify 在冒号上对齐我的参数,并且取得了一些有限的成功.
I want to use uncrustify to align my parameters on colon, and have some limited success.
使用 Can Uncrustify 在 Objective- 中对齐冒号中的信息-C 方法调用? 我的配置文件中有以下内容:
Using the information in Can Uncrustify align colons in Objective-C method calls? I have the following in my config file:
align_oc_decl_colon = true
align_oc_msg_colon_span = 20
我的 .m
文件看起来很棒,像这样:
My .m
-files look great, like this:
- (id)initWithStreetName:(NSString *)streetName
areaCode:(NSString *)areaCode
city:(NSString *)city
country:(NSString *)country
positionLatitude:(NSString *)positionLatitude
positionLongitude:(NSString *)positionLongitude
serverAssignmentId:(NSString *)serverAssignmentId
comment:(NSString *)comment
timestamp:(NSDate *)timestamp
status:(AssignmentStatus)status
但同样的方法在标题中看起来像这样:
but the very same method looks like this in the header:
- (id)initWithStreetName:(NSString *)streetName
areaCode :(NSString *)areaCode
city :(NSString *)city
country :(NSString *)country
positionLatitude :(NSString *)positionLatitude
positionLongitude :(NSString *)positionLongitude
serverAssignmentId :(NSString *)serverAssignmentId
comment :(NSString *)comment
timestamp :(NSDate *)timestamp
status :(AssignmentStatus)status;
关于如何让标题代码看起来像实现代码有什么想法吗?
Any ideas on how I can get the header code to look like the implementation code?
推荐答案
这是 uncrustify 最新版本的一个已知错误.在此回答时,最新的一次是 9 个月前.然而,针对这个错误的补丁已经提交,希望它会出现在下一个版本中.
That is a known bug on the latest release of uncrustify. At the time of this answer the latest one was 9 months ago. However a patch for this error was already committed and hopefully it will appear in the next release.
看这里:https://github.com/bengardner/uncrustify/issues/18
作为临时修复,您可以自己编译当前的母版.使用 XCode 编译将只生成一个二进制文件,您可以在下一个正式版本之前使用它.
As a temporal fix you can compile yourself the current master. Compiling with XCode will generate just one single binary that you can use until the next official release.
bug 在 0.59,应该在 0.60 解决
The bug is on 0.59, should be solved on 0.60
这篇关于在 Objective-C 标头中对齐冒号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!