Skip to content

[2.10.2] Text block method call arguments not indented correctly in context of assignment #977

Description

@ZachCallear

Input and Ouput (see bad specifically):

class SomeClass {

  void doSomething() {
    // bad
    var test = """
      line 1
      line 2
      """.formatted(
      1,
      "some text long enough to cause a wrap of these arguments",
      2,
      3
    );

    // good
    var test = """
    line 1
    line 2
    """
      .formatted(
        1,
        "some text long enough to cause a wrap of these arguments",
        2,
        3
      )
      .formatted(5);

    // good
    System.out.println(
      """
      line 1
      line 2
      """.formatted(
        1,
        "some text long enough to cause a wrap of these arguments",
        2,
        3
      )
    );
  }
}

Expected Output (see bad specifically):

class SomeClass {

  void doSomething() {
    // bad
    var test = """
      line 1
      line 2
      """.formatted(
        1,
        "some text long enough to cause a wrap of these arguments",
        2,
        3
    );

    // good
    var test = """
    line 1
    line 2
    """
      .formatted(
        1,
        "some text long enough to cause a wrap of these arguments",
        2,
        3
      )
      .formatted(5);

    // good
    System.out.println(
      """
      line 1
      line 2
      """.formatted(
        1,
        "some text long enough to cause a wrap of these arguments",
        2,
        3
      )
    );
  }
}

This seems to be limited to situations where there is a text block, with a single, unchained method called on it, having wrapped arguments, which is then used in assignment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions