简体   繁体   中英

Commenting out code in eclipse adding **** automatically between /* and */

While commenting lines of code in eclipse kepler using /* */. After save * added automatically at starting of each line. How to prevent automatic addition of the * char.

Example: Before comment

public static int factorial(int n)
    {   int result = 1;
        for(int i = 2; i <= n; i++)
            result *= i;
        return result;
    }

After Comment

    /*public static int factorial(int n)
    {   int result = 1;
        for(int i = 2; i <= n; i++)
            result *= i;
        return result;
    }*/

After Saving Java Code in Eclipse kepler

    /*
     * public static int factorial(int n) { int result = 1; for(int i = 2; i <= n; i++) result *= i; return result; }
     */

And when uncomment this code

* public static int factorial(int n) { int result = 1; for(int i = 2; i <= n; i++) result *= i; return result; }

it is like that so it takes more time to remove * chars.

Kindly help me how to remove this atuto feature.

Go to your project/workspace preferences, formatter (java code style), edit the profile (you have to copy an existing one if you don't have one yet, you cannot edit the Eclipse [built-in]), Comments and uncheck „Enable block comment formatting“. This disables all formatting for block comments when you save/format your code.

If you don't want this for all block comments, go to the Off/On Tags also in the formatter and enable the tags. You can now //@formatter:off or //@formatter:on enable them for specific sections and disable all formattings for the defined section.

You can look at this menu:

Window -> Preferences -> Java -> Save Action (Action performed on save)

If the "Format Source Code" checkbox is checked also look at this

Window -> Preferences -> Java -> Code Style -> Formatter

Here you can edit the action that the formatter performs for all the things of code

For disable block comment uncheck the "Enable block comment formatting"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM