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

Incorrect indentation of compiler-conditional accessibility modifier for module definition #2867

Closed
1 of 3 tasks
roboz0r opened this issue Apr 28, 2023 · 2 comments · Fixed by #2870
Closed
1 of 3 tasks

Comments

@roboz0r
Copy link

roboz0r commented Apr 28, 2023

Issue created from fantomas-online

Code

module
#if DEBUG
#else
    internal
#endif
    A = 
        let f x = x + x

Result

module
#if DEBUG
#else
internal
#endif
A =
    let f x = x + x

Problem description

As can be seen above, the correct indentation isn't maintained for the accessibility modifier or module name when surrounded by compiler conditionals. The below alternative is a successful workaround:

#if DEBUG
module A =
#else
module internal A =
#endif

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 main branch at 1/1/1990 <- incorrect date is shown on the online editor

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?

@dawedawe
Copy link
Member

dawedawe commented Apr 28, 2023

Hello @roboz0r,
thanks for opening this issue. We handle this correctly for types, but as you see, not for modules.
Maybe this gets you going in the right direction to fix this yourself. Most likely we would need to apply the same trick here as for types.

Are you interested in submitting a PR for this?

@dawedawe
Copy link
Member

To help a bit more, you'd need to do the same as in the fix for #628 but here

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