• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie questions about XCode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie questions about XCode


  • Subject: Re: Newbie questions about XCode
  • From: Johan Lund <email@hidden>
  • Date: Fri, 5 Feb 2010 11:20:15 +0100

Ah, I see your point. If you insert an open brace after in if statement in IntelliJ it just inserts { } right after it. It doesn't add a new line.
If we let XCode do it the way you describe I see a couple of ways to combat it.
A. User move the "return NO;" line up again with the move line/block command, which btw is auto indenting for me as the line is moved around.
B. Use the "surround with" command to intelligently add bracers around the statement.
But I must say that I like the idea that XCode should just realize what I'm trying to do. Its such a common situation anyway.

4 feb 2010 kl. 17.30 skrev Jens Alfke:


On Feb 4, 2010, at 3:07 AM, Johan Lund wrote:

Go to Preferences > Indentation and choose Automatically insert closing "}"
This should be checked by default do doubt.

It annoys a lot of people (including me). Controversial features that do magic things should be off by default.

Why is it annoying?

Because fairly often when I type "{", I'm not about to add a new block, but changing a single statement into a block. For example, if I have:
if (bad)
return NO;
and I want to add another statement before the return, I click at the end of the first line, type "{" and hit Return, then type the new statement. But if Xcode's closing-brace pref is on, it inserts both braces and what I get is
if (bad) {
}
return NO;
and then I have to delete the line with the close-brace that it added.

It could be argued that if I always used braces around even single-line blocks I wouldn't have this problem, but LET'S NOT GO THERE please :)

It could more successfully be argued that Xcode should realize that the following line is already indented and so it shouldn't insert the close-brace. Maybe it could even insert it after that existing indented line. That would be awesome.

—Jens

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Newbie questions about XCode
      • From: Ken Thomases <email@hidden>
References: 
 >Newbie questions about XCode (From: Johan Lund <email@hidden>)
 >Re: Newbie questions about XCode (From: Ian Jackson <email@hidden>)
 >Re: Newbie questions about XCode (From: Johan Lund <email@hidden>)
 >Re: Newbie questions about XCode (From: Jens Alfke <email@hidden>)
 >Re: Newbie questions about XCode (From: Johan Lund <email@hidden>)
 >Re: Newbie questions about XCode (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Xcode contextual menu
  • Next by Date: Re: Xcode contextual menu
  • Previous by thread: Re: Newbie questions about XCode
  • Next by thread: Re: Newbie questions about XCode
  • Index(es):
    • Date
    • Thread