Skip to content

Preserve blank lines in function bodies #554

@Wilfred

Description

@Wilfred

Given the following code:

let foo x y =
  do_some_setup x ;
  do_some_setup y ;

  (* This is the important bit *)
  important_function x ;
  another_important_function x y ;

  cleanup x y

ocamlformat produces:

let foo x y =
  do_some_setup x ;
  do_some_setup y ;
  (* This is the important bit *)
  important_function x ;
  another_important_function x y ;
  cleanup x y

Ideally ocamlformat would preserve the blank lines here. Code formatters for other languages collapse consecutive blank lines, but preserve one line (JS example with prettier).

Possibly related: #521.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions