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

SpaceBeforeClassConstructor inserts two spaces before explicit Interface definition #2226

Closed
3 tasks
panmona opened this issue May 6, 2022 · 1 comment · Fixed by #2284
Closed
3 tasks

Comments

@panmona
Copy link
Contributor

panmona commented May 6, 2022

Issue created from fantomas-online

Code

type IInterface =
    interface
    end

type IInterface2 =
    interface
        abstract member X: unit -> unit
    end

type IInterface3 =
   abstract member X: unit -> unit

Result

type IInterface  =
    interface
    end

type IInterface2  =
    interface
        abstract member X: unit -> unit
    end

type IInterface3 =
    abstract member X: unit -> unit

Problem description

With the setting space_before_class_constructor activated, Fantomas inserts two spaces between the end of interface name and the equal sign. This only happens when using the explicit interface keywords (interface and end) to define the interface.
When the lightweight syntax is used, this doesn't occur as can be seen in the IInterface3.

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-05-04T06:20:06Z - 0e036ac

    { config with
                SpaceBeforeClassConstructor = true }

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 May 6, 2022

Hello, thank you for reporting this issue.
I'm not really sure why this is happening.
If you want to take a stab at this, I would accept a PR to fix this.

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