Skip to content

Double-indentation in lambda #760

@boris-petrov

Description

@boris-petrov

Prettier-Java 2.7.3

Playground link

--print-width 140

Input:

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

Output:

public abstract class Foo implements MyInterface {

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

Expected behavior:
Note the doubly-indented code; in the lambda. Also, the closing braces are off too. I believe the correct code should look like:

public abstract class Foo implements MyInterface {

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

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