This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The IDE's editor has long had a feature where selected code can be commented or uncommented. In 6.0M10 and earlier, you could access this via the editor toolbar (probably also a keybinding). 1) The editor toolbar elements for this feature have been removed and it appears that the toolbar cannot be customized, making this feature harder to discover and users that were used to it being there have no recourse to put it back. 2) The feature itself seems to be available via the "Ctrl-/" keybinding, but has been rewritten to be far less useful, in fact I would argue it is now dangerous to use. Consider: edge->| // This is an embedded comment. |// foo(); If one selects the above lines and executes "Ctrl-/", both lines will be uncommented, which sucks because now my code is broken. And I have to fix it manually. In the old system, the code didn't have to guess these things. It just worked. The new one is guessing and anytime it guesses wrong, it's costing me more time than it saves for the time it guesses correctly.
The menu items under "Source" (Comment, Uncomment) are not enabled as well. Why has this feature been removed?
In eclipse this: // my comment String s; with both lines selected an pressed ctrl-7 (toggle comment) would become //// mycomment // String s; and vice versa. So whenever eclipse finds any line without // it would first comment all selected lines.
*** Issue 111810 has been marked as a duplicate of this issue. ***
*** Issue 112032 has been marked as a duplicate of this issue. ***
Increasing priority, due to duplicates and high number of votes.
Note that this action can't be customized inside Tools|Options|Keymap|Source. It also doesn't work when keymap profile is switched. --- Product Version: NetBeans IDE Dev (Build 070806) Java: 1.5.0_12; Java HotSpot(TM) 64-Bit Server VM 1.5.0_12-b04 System: SunOS version 5.10 running on sparcv9; ISO646-US; en (nb) Userdir: /home/ms159439/.netbeans/dev
To tomzi: it works the same way in NB6. To pcw: We can make the action to check if all the lines contain the '//' at indent 0. That should cover your usecase.
I've checked both idea and eclipse and both behave like NB6 does i.e. in the case edge->| // This is an embedded comment. |// foo(); they uncomment both lines. Also there is a request to insert '//' at the indent level instead of column 0 (issue 78033) which contradicts with this request. Finally IMHO the usecase should be to select the same part of code each time i.e. first comment both lines // This is an embedded comment. foo(); which results in // // This is an embedded comment. // foo(); and then select the SAME lines for uncomment which would return the original lines. Therefore I'm closing as wontfix.
Since this issue is closed, I'm re-opening issue 111810 which was dup'd against this one.