Skip to content

Improve formatting for implements clause #781

Description

@boris-petrov

Prettier-Java 2.7.5

Playground link

--print-width 55

Input:

record Foo(Loooooong a, Looooooooooong b) implements Longer {
  @Override
  public String toString() {
    return "";
  }
}

Output:

record Foo(Loooooong a, Looooooooooong b) implements
	Longer {
	@Override
	public String toString() {
		return "";
	}
}

Expected behavior:

I don't like that Longer is indented the same as the code below it. And perhaps even an empty line could be added. I believe that would be better:

record Foo(Loooooong a, Looooooooooong b) implements
		Longer {

	@Override
	public String toString() {
		return "";
	}
}

This is my personal preference though. Not sure how to simulate that in Prettier for JS. My tries fail miserably - Prettier doesn't want to wrap the extends line, very strange.

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