Andrew Kirna
Andrew Kirna

Reputation: 1396

How can I get JBoss Developer Studio to auto-indent line comments with command+/?

When I comment a line of code in JBoss Developer Studio with command+/, it makes the comment left-aligned. Instead, I'd like the comment to follow the indentation size of my code block. How can I accomplish this?

Current

private static String transformSymbolicName(String unformatted) {
//  String formatted = unformatted.replace('-', '.').toLowerCase();
    return formatted;
}

Desired

private static String transformSymbolicName(String unformatted) {
    // String formatted = unformatted.replace('-', '.').toLowerCase();
    return formatted;
}

JBoss > Preferences > Java > Code Style > Formatter > Comments

Tools: JBoss Developer Studio 8, JDK 1.7.0_80, macOS Sierra

Upvotes: 0

Views: 447

Answers (1)

Dmitrii Bocharov
Dmitrii Bocharov

Reputation: 935

Go to

  1. Window -> Preferences
  2. on the left unwrap Java -> Code Style, choose Formatter
  3. Click Edit...
  4. Go to Comments tab In General Settings block and remove tick for:

    a. Never indent line comments on first column

    b. Never indent block comments on first column

    You can see how it affects in the Preview window on the right

  5. Change profile name on the top and click Apply.

Upvotes: 1

Related Questions