gren-lang / gren-lang/compiler

Gren Format command removes multiline comments, format also moves comments away from documented code

Open
#244 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
503
Forks
29
PR merge metrics
No merged PRs in 30d

Description

When running the gren format <file path> command:

  • Single comments will be moved away from code they are directly above
  • Multiline comments following the same practice as shown in the core code will be removed
  • Multiline comments will be moved away from code they are directly above

Comment blocks written like:

{-| appends new line character
  Some more info I deem important
-}
appendNewLine : String -> String
appendNewLine input =
    input ++ "\n"

Will be formatted to:

appendNewLine : String -> String
appendNewLine input =
    input ++ "\n"

Comment blocks without the | will be moved instead of removed like so:

{- appends new line character

  Hello World
-}
appendNewLine : String -> String
appendNewLine input =
    input ++ "\n"

Will be formatted to:

{- appends new line character

  Hello World
  -}


appendNewLine : String -> String
appendNewLine input =
    input ++ "\n"

Single Line comments will be moved away and above code

-- appends new line character
appendNewLine : String -> String
appendNewLine input =
    input ++ "\n"

Will be formatted to:

-- appends new line character


appendNewLine : String -> String
appendNewLine input =
    input ++ "\n"

Contributor guide

Open the contributing guide

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 reproducing the issue with the gren format <file path> command using the single-line and multiline comment examples in the report. Trace the formatter entry point and add regression coverage for preserving comment text and keeping comments directly above the documented code; done means all shown examples format without removing or moving comments.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Bug
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.