jhipster / prettier-java

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

fix: correct indentation of assignment operations #602

Closed jtkiesel closed 1 year ago

jtkiesel commented 1 year ago

What changed with this PR:

Non-declarative assignment operations now indent properly again.

Example

Input

class Example {

  void example() {
    fileSystemDetails =
      FileHandlerDetails
        .builder()
        .fileSystemType(
          EntityUtils.update(
            entity.getFileSystemDetails().getFileSystemType(),
            update.getFileSystemDetails().getFileSystemType()
          )
        );

    aaaaaaaaaaaaaaaaa = bbbbbbbbbbbbbbbbb ? ccccccccccccccccc : ddddddddddddddddd;

    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = ccccccccccccccccccccccccccccccccccccccc + ddddddddddddddddddddddddddddddddd;
  }
}

Output

class Example {

  void example() {
    fileSystemDetails =
      FileHandlerDetails
        .builder()
        .fileSystemType(
          EntityUtils.update(
            entity.getFileSystemDetails().getFileSystemType(),
            update.getFileSystemDetails().getFileSystemType()
          )
        );

    aaaaaaaaaaaaaaaaa =
      bbbbbbbbbbbbbbbbb ? ccccccccccccccccc : ddddddddddddddddd;

    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =
      bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb =
        ccccccccccccccccccccccccccccccccccccccc +
        ddddddddddddddddddddddddddddddddd;
  }
}

Relative issues or prs:

Closes #601