EclipseCodeFormatter icon indicating copy to clipboard operation
EclipseCodeFormatter copied to clipboard

IntelliJ Code Cleanup does not take the Eclipse formatting into account

Open dkoellner96 opened this issue 1 year ago • 0 comments
trafficstars

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

dkoellner96 avatar Jun 18 '24 11:06 dkoellner96