Skip to content

Auto add brackets to if/else/while/do when format code #2846

Open
@houtaru

Description

@houtaru

Is there a way to add brackets to the if/else/while/do statement when we use format code?

Environment
  • Operating System: Ubuntu 20.04
  • JDK version: 1.8.0, 17.05
  • Visual Studio Code version: 17.05
  • Java extension version:v1.13.0
Steps To Reproduce

Right-click -> Choose Format Doccment

Current Result
public int test(int x) {
    if (x == 1) return x + 1;
    return x * 10;
}
Expected Result
public int test(int x) {
    if (x == 1) {
        return x + 1;
    }
    return x * 10;
}
Additional Informations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions