Skip to content

Adjust indentation of multiline string #593

Closed
@jmattheis

Description

@jmattheis

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.

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