reasonml / reasonml/reason

Change indendtation of functions with many arguments

Open
#2,398 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Printer
Dominant language
OCaml
Stars
10.3k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

Current indentation:

let makeCallback =
    (
      ~target,
      ~method,
      ~getHeader,
      ~create_response,
      ~respond_with_string,
      ~headers_of_list,
      ~read_body,
      ~headers,
      ~context: Context.t,
      reqd,
    ) => {
  open Lwt.Infix;

What I want (and more people on Discord seem to agree):

let makeCallback = (
  ~target,
  ~method,
  ~getHeader,
  ~create_response,
  ~respond_with_string,
  ~headers_of_list,
  ~read_body,
  ~headers,
  ~context: Context.t,
  reqd,
) => {
  open Lwt.Infix;

With my proposal the body of the function is in line with the arguments instead of to the left of them.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the formatter logic that handles functions with many arguments, using the OCaml examples in this issue as a reproduction case. Run the formatter on the example and verify that the opening parenthesis and arguments are indented as shown while the function body aligns with them.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.