jhipster / prettier-java

Prettier Java Plugin
http://www.jhipster.tech/prettier-java/
Apache License 2.0
1.06k stars 103 forks source link

Adjust indentation of multiline string #593

Closed jmattheis closed 10 months ago

jmattheis commented 11 months ago

Prettier-Java 2.2.0

Input:

class Main {

  public static void main(String[] args) {
      System.out.println("""
              abaoeu
              euaoeu
              aoeu
              aoeu
              aoeu
              oaeu
              oaeu
              """);
  }
}

Output:

class Main {

  public static void main(String[] args) {
    System.out.println(
      """
              abaoeu
              euaoeu
              aoeu
              aoeu
              aoeu
              oaeu
              oaeu
              """
    );
  }
}

The start (""") of the multiline string will be moved, but the rest stays the same, it would more readable, if prettier could remove some indentation like:

Expected behavior:

class Main {

  public static void main(String[] args) {
    System.out.println(
      """
      abaoeu
      euaoeu
      aoeu
      aoeu
      aoeu
      oaeu
      oaeu
      """
    );
  }
}

Feel free to close this issue, if it's not something you want to support.