Skip to content

Hash directives around access modifier in module #3188

Closed

Description

@nojaf

Issue created from fantomas-online

Code

[<RequireQualifiedAccess>]
module
    #if !MCP
    internal
    #endif
        Fantomas.Core.CodeFormatterImpl

Result

[<RequireQualifiedAccess>]
module
#if !MCP
internal
#endif
Fantomas.Core.CodeFormatterImpl

Problem description

Needs indentation, the expected result is:

[<RequireQualifiedAccess>]
module
#if !MCP
    internal
#endif
        Fantomas.Core.CodeFormatterImpl

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. (Maybe, not sure yet)
  • I would like a release if this problem is solved.

Options

Fantomas main branch at 1/1/1990

Default Fantomas configuration

Did you know that you can ignore files when formatting by using a .fantomasignore file?
PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.

Activity

  1. Martin521 commented on Sep 19, 2025

    @Martin521
    Contributor

    Indentation of hash directives in general would be great, so that they no longer break the "sticky scroll" feature of VS Code.

  2. nojaf commented on Sep 19, 2025

    @nojaf
    ContributorAuthor

    I don't think the hash directives would be indented, that is not what makes formatting crash.
    You could open an issue for that, but I will tell you it is very likely to be a can of worms.

  3. added a commit that references this issue on Feb 28, 2026
    dc83870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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