Reputation: 1697
In Xcode 4, selecting the Uncomment command only works properly if the comment slashes are at the beginning of the line.
So using ⌘/ on this line:
// sudo make me a sandwich
results in this:
sudo make me a sandwich
But when the comment is indented:
//sudo make me a sandwich
⌘/ results in this:
// //sudo make me a sandwich
If my cursor is in a line that is a comment, I want ⌘/ to uncomment it. Period. Does anyone have a workaround/fix for this?
Upvotes: 13
Views: 3375
Reputation: 592
As of Xcode 6 (at least), this now works.
It does have the caveat, however, of not automatically aligning uncommented code.
In this example
func doSomething() {
doSomethingElse()
// someOtherThing()
//alertUser()
// logTask()
}
Hitting cmd-/
will on each of the commented lines results in:
func doSomething() {
doSomethingElse()
someOtherThing()
alertUser()
logTask()
}
So in effect, Xcode is only removing the //
, not adjusting the whitespace to properly align the lines. If you comment out lines without adding additional whitespace, all will work perfectly. I however, add the extra space after comments to make that line more readable, and so this still contains a bug (or feature request) for me...
Upvotes: 0
Reputation: 49034
Two solutions:
Upvotes: 16