Skip to content

Fantomas inserts space that breaks index lookups (without a dot) #2519

@dbrattli

Description

@dbrattli

Issue created from fantomas-online

Code

let test (negotiationRules: IDictionary<string, unit -> unit -> unit>) =
    let mimeType = "foo"
    negotiationRules[ mimeType ] () ()

Result

let test (negotiationRules: IDictionary<string, unit -> unit -> unit>) =
    let mimeType = "foo"
    negotiationRules [ mimeType ] () ()

Problem description

Fantomas inserts extra space between i.e negotiationRules and the [...] which breaks the code. This seems to happen if there are more than one argument after e.g negotiationRules [ mimeType ] () will be formatted correctly whiles negotiationRules [ mimeType ] () () will not.

The example is a simplified version of: https://github.com/dbrattli/Fable.Giraffe/blob/main/src/Negotiation.fs#L131

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 master branch at 2022-09-17T05:39:07Z - c1a99d4

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