reasonml / reasonml/reason

Docblock comment refmts with parens around documented item:

Open
#1,815 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

GOOD FIRST TASK KIND: FEATURE REQUEST Printer
Dominant language
OCaml
Stars
10.3k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

  /** raise the same error than if we failed to match */
  (
    if (! Re_pcre.pmatch(~rex=allR, err)) {
      raise(Not_found);
    } else {
      let hintR = {|Syntax error:([\s\S]+)|};
      let hint = get_match_maybe(hintR, err);
      /* assuming on the same row */
      let ((startRow, startColumn), (_, endColumn)) = range;
      File_SyntaxError({
        hint: Helpers.optionMap(String.trim, hint),
        offendingString:
          Helpers.stringSlice(
            ~first=startColumn,
            ~last=endColumn,
            List.nth(cachedContent, startRow),
          ),
      });
    }
  );

The /** comment is actually a ppx attribute in the shape/style of a comment so they must be syntactically valid - however, I don't think the parens are required here at print time because it parses fine.

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 with the refmt formatting path for Reason docblock attributes and reproduce the issue using the snippet in this report. Compare the printed output with the accepted syntax, and consider the work complete when valid parenthesized expressions no longer retain unnecessary parentheses after formatting.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.