How to format this code please?

Hi.

I'm using Mike Ash's MACollectionUtilities which includes a handy DICT() macro to create NSDictionaries. Instead of

[NSDictionary dictionaryWithObjectsAndKeys:@"value",@"key",...nil]

you can write:

DICT(@"key",@"value")

which, if you don't have access to the new literals syntax is very nice.

Now sometimes these spill over into a long-line, such as:

return DICT(@"authority",[self signingAuthority],@"time",time,@"nonce",nonce,@"hash",hash);


and, when using Xcode, I like to format them as:

return DICT(@"authority",

                  [self signingAuthority],

                  @"time",

                  time,

                  @"nonce",

                  nonce,

                  @"hash",

                  hash);


i.e. all successive arguments aligned with the first argument. However AppCode insists on formatting as:

return DICT(

@"authority",

[self signingAuthority],

@"time",

time,

@"nonce",

nonce,

@"hash",

hash);


i.e. all successive arguments aligned with the 'r' in return.

I've tried messing with a number of the Objective-C code formatting settings in vain and cannot seem to get the code formatted the way I want it.

Can anyone advise me on the specific settings I need to use? AppCode 1.6EAP OC-120.38

Kind regards,

Matt

p.s. Also how to get code formatting in these forums?

Added AppCode version

1 comment
Comment actions Permalink

Matt, this is a bug (or, better, missing functionality) - there are a few macro-related issues in the formatter at the moment. We'll try to resolve them in future updates.
Here is a request for your problem: http://youtrack.jetbrains.com/issue/OC-4555

And here is how you can format the code snippets in the forum:
Screen Shot 2012-07-10 at 09.55.24 .png

Cheers!

0

Please sign in to leave a comment.