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

Trivia between xml doc and type not restored #2143

Closed
1 of 3 tasks
nojaf opened this issue Mar 11, 2022 · 1 comment · Fixed by #2385
Closed
1 of 3 tasks

Trivia between xml doc and type not restored #2143

nojaf opened this issue Mar 11, 2022 · 1 comment · Fixed by #2385

Comments

@nojaf
Copy link
Contributor

nojaf commented Mar 11, 2022

Issue created from fantomas-online

Code

/// Represents a line number when using zero-based line counting (used by Visual Studio)
// #if CHECK_LINE0_TYPES

// #else
type Line0 = int
// #endif

Result

/// Represents a line number when using zero-based line counting (used by Visual Studio)
type Line0 = int
// #endif

Problem description

Discovered by:

/// Represents a line number when using zero-based line counting (used by Visual Studio)
#if CHECK_LINE0_TYPES
// Visual Studio uses line counts starting at 0, F# uses them starting at 1 
[<Measure>] type ZeroBasedLineAnnotation

type Line0 = int<ZeroBasedLineAnnotation>
#else
type Line0 = int
#endif

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 branch at 2022-03-10T17:18:56Z - c455e63

Default Fantomas configuration

Signature file

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 Mar 11, 2022

To solve this, I need to type keyword as part of the trivia for SynTypeDefnSig.
Similar to https://fsharp.github.io/fsharp-compiler-docs/reference/fsharp-compiler-syntaxtrivia-syntypedefntrivia.html

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.

1 participant