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

Comment after equals in record type is lost #2001

Closed
3 tasks
nojaf opened this issue Dec 22, 2021 · 3 comments · Fixed by #2125
Closed
3 tasks

Comment after equals in record type is lost #2001

nojaf opened this issue Dec 22, 2021 · 3 comments · Fixed by #2125

Comments

@nojaf
Copy link
Contributor

nojaf commented Dec 22, 2021

Issue created from fantomas-online

Code

type V = // comment
    { X: SomeFieldType
      Y: OhSomethingElse
      Z: ALongTypeName }

Result

type V =
    { X: SomeFieldType
      Y: OhSomethingElse
      Z: ALongTypeName }

Problem description

Comment should still be there.

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 4.6 branch at 1/1/1990

default config

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

@nojaf
Copy link
Contributor Author

nojaf commented Dec 22, 2021

Most likely happens as well with signature files.

@nojaf nojaf added the next-fcs label Jan 22, 2022
@evenbrenden
Copy link

Looks like this generally happens with comments on the first line of multiline type declarations:

type Type = // COMMENT
    Type

type Type = Type

@nojaf
Copy link
Contributor Author

nojaf commented Jan 24, 2022

I'm actually trying to address this in the F# Compiler, by having a notion of the range of the equals token.
See nojaf@d21ec81

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

Successfully merging a pull request may close this issue.

2 participants