Skip to content

Formatting of nested -ifdef/-ifndef macro directives #345

@TD5

Description

@TD5

Sometimes I need to nest macro directives, and when I do so, it's nice to indent them as one would do with code generally - just to keep it readable - however, erlfmt seems to want to remove all indentation, for example:


-ifdef(FOO).
  -ifndef(BAR).
    -define(BAZ, true).
  -endif.
-endif.

--[apply erlfmt]-->

-ifdef(FOO).
-ifndef(BAR).
-define(BAZ, true).
-endif.
-endif.

I don't think there's any mention of this in the style guide. As far as I can see, the macro-related stuff covers various topics, but doesn't consider flow control for macro definitions, and treats it as I would treat a list of several -defines or something. Also, I am not a frequent user of erlfmt, so maybe I am doing something wrong, making this a support request rather than a feature request.

I know nesting macro directives like this is probably Not Good™, but I'd prefer not to compound that by needing to have them flattened out.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions