Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to make Xcode handle brackets more intelligently?

In Xcode, if you are calling a method that takes a series of flags as an argument, when you type the right bracket character, it creates a new left bracket at the last flag, rather than at the start of the line. Is there any way to fix this?

    // Type this...
    someFunc withFlags:FlagA|FlagB|FlagC

    // Now type a right bracket ]
    someFunc withFlags:FlagA|FlagB|[FlagC ]

    // It should be this:
    [someFunc withFlags:FlagA|FlagB|FlagC]
like image 985
GoldenJoe Avatar asked Dec 21 '13 02:12

GoldenJoe


Video Answer


1 Answers

Turn-On Xcode->Preferences->TextEditing->Editing->Automatically balance brackets in ObjectiveC method calls

I'm using Xcode Version 5.0.2 (5A3005). The below both of them worked fine for me.It automatically created left bracket when I closed the right one.

 [self someFunc:1 Flag:YES|YES|YES];
 [self someFunc:YES|YES|YES];

- (void)someFunc:(int)x Flag:(BOOL)yes
{

}
- (void)someFunc:(BOOL)yes
{

}

Here is my Xcode settings

enter image description here

like image 92
Shamsudheen TK Avatar answered Oct 11 '22 00:10

Shamsudheen TK