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

XML Doc comments on DU cases seem to get shuffled #2188

Closed
3 tasks done
baronfel opened this issue Apr 5, 2022 · 2 comments · Fixed by #2197
Closed
3 tasks done

XML Doc comments on DU cases seem to get shuffled #2188

baronfel opened this issue Apr 5, 2022 · 2 comments · Fixed by #2197

Comments

@baronfel
Copy link
Contributor

baronfel commented Apr 5, 2022

Issue created from fantomas-online

Code

/// Represents reasons why a text document is saved.
type TextDocumentSaveReason =
/// Manually triggered, e.g. by the user pressing save, by starting debugging,
/// or by an API call.
| Manual = 1

/// Automatic after a delay.
| AfterDelay = 2

/// When the editor lost focus.
| FocusOut = 3

Result

/// Represents reasons why a text document is saved.
type TextDocumentSaveReason =
    /// Manually triggered, e.g. by the user pressing save, by starting debugging,
    /// or by an API call.
    | Manual = 1
    /// Automatic after a delay.
    |

    AfterDelay = 2
    /// When the editor lost focus.
    |

    FocusOut = 3

Problem description

Found this while converting Ionide.LanguageServerProtocol to use Fantomas. The formatting errors cause compilation problems because there's no indent after the second and third pipes and their respective DU cases. The Newlines after the pipe are also not-ideal, but that's minor compared to the compilation issue.

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-04-04T14:08:13Z - e784cd6

Default Fantomas configuration

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

nojaf commented Apr 5, 2022

Hello, this rings a bell and looks similar to #2155.
I have a script ready for another YouTube video to solve this one.
In short, you want to correct the range of SynEnumCase in case there is a bar and/or XML comment.
How annoying is this bug for you? If it is a blocker I can just solve it easily, otherwise, I'd like to wait a bit until I can make that recording. Speak your mind please, I'm ok with either outcome.

@baronfel
Copy link
Contributor Author

baronfel commented Apr 5, 2022

No rush, it's not critical. A video is a great idea 😊

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