Skip to content

[formatter] Set org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true by default #2185

@fbricon

Description

@fbricon

Even though the jdt.ls sets it to true, org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch seems to be ignored.

The following code is not indented as expected:

public static void main(String[] args) {
    switch (args.length) {
    case 0:
        System.err.println("none");
        break;
    case 1:
        System.err.println("one");
        break;
    default:
        System.err.println("many");
    }
}

It should be formatted as:

public static void main(String[] args) {
    switch (args.length) {
        case 0:
            System.err.println("none");
            break;
        case 1:
            System.err.println("one");
            break;
        default:
            System.err.println("many");
    }
}

BTW the https://github.com/redhat-developer/vscode-java/blob/master/formatters/eclipse-formatter.xml template should also set it to true by default.

This is definitely a no-brainer.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions