Skip to content

Feature request: preserve more blank lines in function body #1047

@iwinux

Description

@iwinux

With option sequence-blank-line = preserve-one (added by #814), blank lines in sequences are preserved as expected, but other blank lines in function body are still "eaten".

For example (code adapted from Cohttp example):

let async_main =
  let* resp, raw_body = Client.get (Uri.of_string "https://api.github.com/") in

  let* body = Body.to_string raw_body in
  let code = resp |> Response.status |> Code.code_of_status in

  Printf.printf "Status: %d\n" code;
  Printf.printf "Body: %s\n" body;
  Lwt.return ()

becomes

let async_main =
  let* resp, raw_body = Client.get (Uri.of_string "https://api.github.com/") in
  let* body = Body.to_string raw_body in
  let code = resp |> Response.status |> Code.code_of_status in
  Printf.printf "Status: %d\n" code;
  Printf.printf "Body: %s\n" body;
  Lwt.return ()

It would be great if such blank lines are left intact, so that some blocks of logic can "stand out" by keeping "distance" from other blocks.

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