0

I have always been wondering about that Xcode method styling. When you start writing some declared method it offers you autocompletion of whole method in one line like this:

_timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(timerRefresh) userInfo:nil repeats:YES];

Is it possible to automatically arrange it like this:

_timer = [NSTimer scheduledTimerWithTimeInterval:5.0
                                          target:self
                                        selector:@selector(timerRefresh)
                                        userInfo:nil
                                         repeats:YES];

Thanks.

Monolo
  • 18,205
  • 17
  • 69
  • 103
zhuber
  • 5,364
  • 3
  • 30
  • 63
  • 1
    As Alexander points out, make your own code snippet. I've created a dozen of my own snippets and my ability to knock out common code has gone through the roof. And you can format that snippet any way you want. – Rob Jun 05 '13 at 13:17

2 Answers2

2

Try using the code snippet library.

Alexander
  • 8,117
  • 1
  • 35
  • 46
  • 4
    I don't see how that's helping. Do you suggest adding a snippet for each and every method in Cocoa or am I missing something ? – Guillaume Algis Jun 05 '13 at 13:18
  • Only for the ones you need to be multilined. I doubt that there is an alternative way to change internal behavior of autocomplete methods. – Alexander Jun 05 '13 at 13:19
2

You probably could use Uncrustify with the align_oc_msg_colon_span value set to 1. See this SO question for more informations.

If you want to make it more automatic, you might want to give BBUncrustifyPlugin a try, and bind its "Uncrustify Active File" menu command to a keyboard shortcut.

The BBUncrustifyPlugin is available in Alcatraz (along with a bunch of other very neat plugins), or you could install it by hand (but I'd recommend trying Alcatraz. Really :)).

This will not make it totally automatic (as "re-indent as you type" automatic) but this is pretty close in my opinion.

Community
  • 1
  • 1
Guillaume Algis
  • 10,705
  • 6
  • 44
  • 72