views:

40

answers:

2

In XCode there are some useful functions commented out with /* and a corresponding */. Is there a shortcut that will quickly remove these? Can a shortcut be made using AppleScript, or is there a better way?

+3  A: 

There's a better way to comment and uncomment code: Cmd-/. It puts // in front of every line, or removes // if it's at the front of the line. This has many advantages. It's easier to do in Xcode. It nests correctly. It makes it very clear where commented out code is, even when read outside of an IDE (such as in diffs and code-review tools). It makes it much more obvious in diffs when a huge amount of code has just been committed (removing two lines makes it look like a little change, but you may have just injected hundreds of lines of untested-in-the-current-codebase code).

If you're in a situation where you're hunting for a shortcut, then switching to leading // is almost certainly a better solution.

Rob Napier
A: 

You can comment/uncomment any selected code block with Command + /

Press key combo again to toggle remove the comments from an already commented code block

Brock Woolf
If I do that it just adds a / which does uncomment the code but what about the remaining */ at the end?
awakeFromNib