Skip to content

Comment inside empty Elmish children is lost #1179

Closed
@nojaf

Description

Issue created from fantomas-online

Code

a [] [
    // def
]

Result

a [] []

Problem description

Comment disappears.
Reported by @reinux in #932

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas Master at 09/30/2020 06:55:15 - b0dedcd

Default Fantomas configuration.


Hey @reinux, as I tried to explain in #932, please always create a new issue when it comes to bugs related to comments.
I will judge myself if they are related or not. There is no one fix that will solve all these sorts of issues so we need to tackle case by case.

That being said, this issue is actually not that hard to solve.
You can see in the Trivia tab that the comment was detected and assigned to a token node.

image

The problem here is that we don't call print content before that token in CodePrinter. Notice we are doing it after.

More information on how Fantomas technically works can be found on YouTube and in the contributing guide.
I hope I can encourage you or someone else to try and take a stab at this.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions