When commenting out a piece of code in xcode
//code
If you click comment again it adds more comments
////code
does anyone know how to prevent this?
By selecting a few lines of code (pressing ⇧+↑ or ⇧+↓), you can comment a bunch of lines in a single shot with the ⌘ + / shortcut. If the lines are already comments, the same shortcut will uncomment them.
The leading characters // are added to the beginning of each line when commenting one or more lines of code. You can also block comment multiple lines of code using the characters /* */ .
It looks like a bug to me .... if you do command + ] it gets rid of the tabs.. The tabs are the ones causing the issue. Xcode sees the tabs and adds more comment lines. so do command +] twice or until all the tabs are gone. and then you can remove the comments using the command+/ (comment selection command)
When you "click comment again" you have to have the //
selected (and optionally the rest of the line).
Usually when you comment the first time Xcode will select the text such that pressing the comment shortcut again will uncomment.
Is nothing selected after you comment the first time?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With