Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes the first comment above the member of the list #990

Closed
1 of 3 tasks
Thecentury opened this issue Jul 29, 2020 · 2 comments · Fixed by #1005
Closed
1 of 3 tasks

Removes the first comment above the member of the list #990

Thecentury opened this issue Jul 29, 2020 · 2 comments · Fixed by #1005

Comments

@Thecentury
Copy link

Issue created from fantomas-online

Code

let x = [
    // comment
    1
    // another comment
    2
]

Result

let x =
    [ 1
      // another comment
      2 ]

Problem description

Fantomas removes the first comment.

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 07/20/2020 08:56:02 - d42a156

Name Value
IndentSize 4
MaxLineLength 120
SemicolonAtEndOfLine false
SpaceBeforeParameter true
SpaceBeforeLowercaseInvocation true
SpaceBeforeUppercaseInvocation false
SpaceBeforeClassConstructor false
SpaceBeforeMember false
SpaceBeforeColon false
SpaceAfterComma true
SpaceBeforeSemicolon false
SpaceAfterSemicolon true
IndentOnTryWith false
SpaceAroundDelimiter true
MaxIfThenElseShortWidth 40
MaxInfixOperatorExpression 50
MaxRecordWidth 40
MaxArrayOrListWidth 40
MaxValueBindingWidth 40
MaxFunctionBindingWidth 40
MultilineBlockBracketsOnSameColumn false
NewlineBetweenTypeDefinitionAndMembers false
KeepIfThenInSameLine false
MaxElmishWidth 40
SingleArgumentWebMode false
AlignFunctionSignatureToIndentation false
AlternativeLongMemberDefinitions false
StrictMode false
@knocte
Copy link
Contributor

knocte commented Aug 10, 2020

Removing comments is pretty bad because there's no way to detect this bug (it's failing silently), so using fantomas makes you lose important information. I'd mark this as high priority if you ask me.

@nojaf
Copy link
Contributor

nojaf commented Aug 10, 2020

The missing comment is now assigned to SynExpr.CompExpr.
image

Trivia for that node is most likely not being printed somewhere in CodePrinter, so a fix done there.
Alternatively, you could try and assign the comment to SynExpr.Const as that is being printed as you can see for the other comment.

See video to have a better understanding about what I'm talking about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants