Skip to content

Comment after arrow is being duplicated #1082

Closed
@nojaf

Description

Issue created from fantomas-online

Code

List.tryFind(fun { Type = t; Range = r }  ->
                    match t with
                    | MainNode SynMemberDefn_Member
                    | MainNode SynMemberSig_Member -> // trying to get AST trivia
                        RangeHelpers.``range contains`` r rangeOfBindingAndRhs

                    | Token(MEMBER, _) -> // trying to get token trivia
                        r.StartLine = rangeOfBindingAndRhs.StartLine

                    | _ -> false
                )

Result

List.tryFind (fun { Type = t; Range = r } -> // trying to get AST trivia
    match t with
    | MainNode SynMemberDefn_Member
    | MainNode SynMemberSig_Member -> // trying to get AST trivia
        RangeHelpers.``range contains`` r rangeOfBindingAndRhs

    | Token (MEMBER, _) -> // trying to get token trivia
        r.StartLine = rangeOfBindingAndRhs.StartLine

    | _ -> false)

Problem description

Trivia bug: the range of the first arrow should be limited instead of the entire lambda body.

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 09/03/2020 19:59:28 - 573b009

Default Fantomas configuration

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions