Skip to content

Formatting not stable with comment between class and static function call #712

Closed
@jmattheis

Description

@jmattheis

prettier: 3.4.2
pretier-plugin-java: 2.6.6

The formatting is not stable with the following code structure and needs to be run twice to get to a stable state:

$ cat initial.java
package main;

class Main {

  public static void main(String[] args) {
    return MyClass
        // comment
        .doSomething();
  }
}
$ yarn -s prettier --plugin prettier-plugin-java initial.java | tee first.java
package main;

class Main {

    public static void main(String[] args) {
        return MyClass// comment
        .doSomething();
    }
}
$ yarn -s prettier --plugin prettier-plugin-java first.java | tee second.java
package main;

class Main {

    public static void main(String[] args) {
        return MyClass.doSomething(); // comment
    }
}

Maybe related #592

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions