Skip to content

[2.7.6] Big regression with indentation because of the fix for ternaries #785

@boris-petrov

Description

@boris-petrov

Congrats on the new release @jtkiesel! However, there's a nasty regression in certain cases.

Prettier-Java 2.7.6

Playground link 1
Playground link 2

--print-width 140

Input:

public abstract class Foo implements MyInterface {
  @Override public String foo() {
    return true ? "" :
		foo.method2(r ->
		  Context.a().m(1, a -> {
        code;
      })
		);
  }
}

Output:

public abstract class Foo implements MyInterface {

	@Override
	public String foo() {
		return true
			? ""
			: foo.method2(r ->
					Context.a().m(1, a -> {
						code;
					})
				);
	}
}

Expected behavior:

public abstract class Foo implements MyInterface {

	@Override
	public String foo() {
		return true
			? ""
			: foo.method2(r ->
				Context.a().m(1, a -> {
					code;
				})
			);
	}
}

The two playground links show regressions for these two previous cases (but this time in a ternary):

#764
#760

I'm not sure there aren't more cases that regressed.

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