Skip to content

Formatting with comment in fluent call breaks code #2694

Open
@cmeeren

Description

@cmeeren

Issue created from fantomas-online

Code

if ctx.Configuration.GetValue "Log:UseEmail" then
  loggerConfig
    // Comment
    .WriteTo.Logger(fun cfg ->
      cfg
        .Filter.ByIncludingOnly(fun e -> e.Level = LogEventLevel.Warning)
        .WriteTo.Email()
      |> ignore
    )
  |> ignore

Result

if ctx.Configuration.GetValue "Log:UseEmail" then
    loggerConfig
    // Comment
    .WriteTo.Logger
        (fun cfg ->
            cfg
                .Filter
                .ByIncludingOnly(fun e -> e.Level = LogEventLevel.Warning)
                .WriteTo.Email()
            |> ignore)
    |> ignore

Problem description

Formatted code is incorrectly indented (missing indentation of comment and .WriteTo), which makes compilation fail with Unexpected symbol '.' in if/then/else expression. Expected incomplete structured construct at or before this point or other token..

Extra information

  • The formatted result breaks my code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas v5.2 branch at 1/1/1990

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions