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

Extra new line is added before attributes #1097

Closed
3 tasks
nojaf opened this issue Sep 4, 2020 · 0 comments · Fixed by #1103
Closed
3 tasks

Extra new line is added before attributes #1097

nojaf opened this issue Sep 4, 2020 · 0 comments · Fixed by #1103

Comments

@nojaf
Copy link
Contributor

nojaf commented Sep 4, 2020

Issue created from fantomas-online

Code

namespace Meh

[<StringEnum>]
[<RequireQualifiedAccess>]
type PayableFilters = | [<CompiledName "statusSelector">] Status

Result

namespace Meh


[<StringEnum>]
[<RequireQualifiedAccess>]
type PayableFilters = | [<CompiledName "statusSelector">] Status

Problem description

Trivia problem.
Change in CodePrinter:

and genSigModuleOrNamespace astContext (SigModuleOrNamespace (ats, px, ao, s, mds, _, moduleKind) as node) =
    let range =
        match node with
        | SynModuleOrNamespaceSig (_, _, _, _, _, _, _, range) -> range

    let sepModuleAndFirstDecl =
        let firstDecl = List.tryHead mds

        match firstDecl with
        | None ->
            if moduleKind.IsModule then
                sepNlnForEmptyModule SynModuleOrNamespaceSig_NamedModule range
                +> rep 2 sepNln
            else
                sepNlnForEmptyNamespace range +> sepNln
        | Some mdl ->
            match mdl with
            | SynModuleSigDecl.Types _ ->
                let attrs = getRangesFromAttributesFromSynModuleSigDeclaration mdl
                sepNlnConsideringTriviaContentBeforeWithAttributesFor SynModuleSigDecl_Types mdl.Range attrs
            | SynModuleSigDecl.Val _ -> sepNlnConsideringTriviaContentBeforeForMainNode ValSpfn_ mdl.Range
            | _ -> sepNone
            +> sepNln

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.0.0-beta-003

Default Fantomas configuration

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.

1 participant