Skip to content

Add blank lines between more class members #1714

Open
@PiotrRogulski

Description

@PiotrRogulski

What input code did you provide to the formatter?

// All in one line, so that the formatter has to do all the work
class C {const C(); const C.another(); void f(){;} final x = 1; final y = 2; void foo() {;} void bar() {;} final z = 5;}

What output did the formatter produce?

class C {
  const C();
  const C.another();
  void f() {
    ;
  }

  final x = 1;
  final y = 2;
  void foo() {
    ;
  }

  void bar() {
    ;
  }

  final z = 5;
}

What output did you expect or want the formatter to produce?

Describe how you expected the formatter to format the code, ideally by showing what you had in mind as code.

class C {
  const C();
  const C.another();

  void f() {
    ;
  }

  final x = 1;
  final y = 2;

  void foo() {
    ;
  }

  void bar() {
    ;
  }

  final z = 5;
}

Anything else we should know?

This request is somewhat of an extension of #930 – the formatter adds lines only between the methods, and it would be nice if it added blank lines also before the method, if there's something else (like a field or a constructor).

I'd like the formatter to enforce the one-empty-line-rule, not just go along with it only if I add an empty line.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions