Eclipse toggle comment indented

Can I make Eclipse to toggle comment like this instead?

It's a three step process..

Step-1:- Select desired code.

if(bar) {
  bam += 1;
}

Step-2:- Hit Control + 7 OR Control + /

//    if(bar) {
//      bam += 1;
//    }

Step-3:- Hit Control + Shift + F

   // if(bar) {
   // bam += 1;
   // }

UPDATE

Also, when uncommenting, the Eclipse autoformatter does not restore the previous indentation

Like commenting, uncommenting is also three step process:-

  1. select
  2. Contorl + /
  3. Control + Shift + F

it applies it's own formatting rules instead.

You can change these formatting rules. Windows --> Preferences --> Java --> Code Style --> Formatter --> Edit --> Comments Tab.

Eclipse does not allow editing default built-in profile. Create new profile and inherit all the properties from built-in profile, then you can customize the newly created profile.


seems like a real solution for this is not going to happen in eclipse

https://bugs.eclipse.org/bugs/show_bug.cgi?id=321092

Tags:

Eclipse