Skip to content

Double-indentation of method arguments #764

@boris-petrov

Description

@boris-petrov

Prettier-Java 2.7.3

Playground link

--print-width 100

Input:

public abstract class Foo implements MyInterface {
	@Override
	public String foo() {
		var content = this.longmethodname(
			"long text",
			(argument1, argument2, argument3, argument5) -> {
				Context.a().m(1, a -> {
					code;
				});
			}
		);
	}
}

Output:

public abstract class Foo implements MyInterface {

	@Override
	public String foo() {
		var content = this.longmethodname(
				"long text",
				(argument1, argument2, argument3, argument5) -> {
					Context.a().m(1, a -> {
							code;
						});
				}
			);
	}
}

Expected behavior:

public abstract class Foo implements MyInterface {

	@Override
	public String foo() {
		var content = this.longmethodname(
			"long text",
			(argument1, argument2, argument3, argument5) -> {
				Context.a().m(1, a -> {
					code;
				});
			}
		);
	}
}

This also hits another bug. But this one here is for the two arguments of longmethodname - they shouldn't be indented twice.

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