Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align on colons in Objective-C headers

I want to use uncrustify to align my parameters on colon, and have some limited success.

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

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?

like image 950
Pål Brattberg Avatar asked Jun 11 '26 23:06

Pål Brattberg


1 Answers

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.

Look here: https://github.com/bengardner/uncrustify/issues/18

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.

The bug is on 0.59, should be solved on 0.60

like image 55
SystematicFrank Avatar answered Jun 14 '26 03:06

SystematicFrank



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!