gren-lang / compiler

Compiler for the Gren programming language
https://gren-lang.org
Other
342 stars 21 forks source link

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

Open MaeBrooks opened 4 months ago

MaeBrooks commented 4 months ago

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"
robinheghan commented 4 months ago

Thank you for reporting this.

The person who contributed the formatter suddenly stopped working on it, and it hasn't seen activity in a while.

I fully expect to re-write the parser with gren-in-gren, though.