objective-c - 在 Objective-C header 中对齐冒号

标签 objective-c uncrustify

我想使用 uncrustify 将我的参数与冒号对齐,并取得了一些有限的成功。

使用 Can Uncrustify align colons in Objective-C method calls? 中的信息我的配置文件中有以下内容:

align_oc_decl_colon = true
align_oc_msg_colon_span = 20

我的 .m - 文件看起来很棒,像这样:

- (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

但同样的方法在标题中看起来像这样:

- (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;

关于如何让 header 代码看起来像实现代码有什么想法吗?

最佳答案

这是 uncrustify 最新版本的一个已知错误。在回答这个问题时,最新的回答是在 9 个月前。然而,针对此错误的补丁已经提交,希望它会出现在下一个版本中。

看这里: https://github.com/bengardner/uncrustify/issues/18

作为临时修复,您可以自己编译当前的主控。使用 XCode 编译只会生成一个二进制文件,您可以在下一个正式版本发布之前使用它。

Bug 在 0.59 上,应该在 0.60 上解决

关于objective-c - 在 Objective-C header 中对齐冒号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10901191/

相关文章:

ios - IOS无法保存json

uncrustify:在函数定义的大括号之前换行

ios - iOS 应用程序的 xcode 中的 Uncrustify 错误

ios - 如何使用 Xcode9 在 Debug 区域中显示此 Log 消息?

objective-c - 如何判断 NSPanel 是否不再在 View 中?

c++ - Uncrustify:删除空间打开/关闭 block

objective-c - Uncrustify ObjC 换行符后的方法

configuration - 如何在可视化代码中配置uncrustify?

ios - UIButton - 复选标记未显示

iphone - 如何让用户的 iPhone 显示屏保持开启状态?