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.

Bug 111184 - Changes to "comment/uncomment code" make it worse.
Summary: Changes to "comment/uncomment code" make it worse.
Status: RESOLVED WONTFIX
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: Sun All
: P2 blocker with 1 vote (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-27 01:07 UTC by _ pcw
Modified: 2007-11-05 13:42 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ pcw 2007-07-27 01:07:03 UTC
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.
Comment 1 tkellerer 2007-08-02 20:37:43 UTC
The menu items under "Source" (Comment, Uncomment) are not enabled as well. 
Why has this feature been removed?
Comment 2 tomzi 2007-08-06 12:10:01 UTC
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.
Comment 3 Max Sauer 2007-08-06 16:26:32 UTC
*** Issue 111810 has been marked as a duplicate of this issue. ***
Comment 4 Max Sauer 2007-08-06 16:26:50 UTC
*** Issue 112032 has been marked as a duplicate of this issue. ***
Comment 5 Max Sauer 2007-08-06 16:28:42 UTC
Increasing priority, due to duplicates and high number of votes. 
Comment 6 Max Sauer 2007-08-06 16:36:47 UTC
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
Comment 7 Miloslav Metelka 2007-08-06 17:34:52 UTC
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.
Comment 8 Miloslav Metelka 2007-08-07 18:20:03 UTC
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.
Comment 9 err 2007-08-07 19:52:14 UTC
Since this issue is closed, I'm re-opening issue 111810 which was dup'd against this one.