Skip to content

IntelliJ Code Cleanup does not take the Eclipse formatting into account #270

Open
@dkoellner96

Description

@dkoellner96

When I start Code Cleanup in IntelliJ it seems like it does not use the Eclipse Formatter and it will change indentations. I have to reformat the code and then it looks right but I don't want to do this extra step.

What steps will reproduce the issue?

  1. Insert the following code, whose format is based on the Eclipse Formatter
return someMethode(someParameter, someParameter2, someParameter3)
    && someMethode(someParameter, someParameter3, someParameter4)
    && someMethode(someParameter, someParameter5, someParameter6)
        ? something: null;
  1. Configure the IntelliJ Code Cleanup and select the option Java > multiple operators with different precedence and set severity to Warning
  2. Run Clean Up

What is the expected result?

New braces are set. Indentation will not be changed

return (someMethode(someParameter, someParameter2, someParameter3)
    && someMethode(someParameter, someParameter3, someParameter4)
    && someMethode(someParameter, someParameter5, someParameter6))
        ? something: null;

What happens instead?

The indentation changed. Reformating will be necessary

return (someMethode(someParameter, someParameter2, someParameter3)
    && someMethode(someParameter, someParameter3, someParameter4)
    && someMethode(someParameter, someParameter5, someParameter6))
    ? something: null;

IDEs

IntelliJ

IntelliJ IDEA 2024.1 (Ultimate Edition)
Build #IU-241.14494.240, built on March 28, 2024

Eclipse

Eclipse IDE for Enterprise Java and Web Developers (includes Incubating components)

Version: 2024-03 (4.31.0)
Build id: 20240307-1437

Eclipse Formatter Settings

Here are my configured settings:
Eclipse_formatter_anonym.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions