Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jmattheis opened this issue Jan 16, 2025 · 1 comment · Fixed by #713 or #715
Closed

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

jmattheis opened this issue Jan 16, 2025 · 1 comment · Fixed by #713 or #715

Comments

@jmattheis
Copy link

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

@clementdessoude
Copy link
Contributor

Indeed, thanks for raising this issue @jmattheis. I'll try to have a look this weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants