Menu

#198 [PATCH] New options for enum indentation

None
closed-fixed
None
5
2026-03-21
2025-08-12
No

The attached patch adds some new options to the formatter for indenting enums including unit tests.

The options are nearly identical to the uses options and allow the separation of enum identifiers in different lines.

1 Attachments

Discussion

  • Christoph "baka0815" Schwerdtfeger

    Screenshot

     
  • Thomas Mueller

    Thomas Mueller - 2025-08-14

    Unfortunately this does not work as expected. Try to format this:

    type
      TEnum = (a, // description for a
       b, // description for b
        c // description for c
    );
    

    If you enable both options, this will lose the declarations for b and c.

    type
      TEnum = (
          a
        , // description for ab
        , // description for bc // description for c
          );
    

    If you disable "Before the comma" it works fine.
    (I just pasted this code into the preview window.)

    The same problem exists with the formatting code for the uses list, as I just found out.
    (bug report on that:
    https://sourceforge.net/p/gexperts/bugs/442/ )

     

    Last edit: Thomas Mueller 2025-08-14
  • Christoph "baka0815" Schwerdtfeger

    Ouch... I will take a look at this.

     
  • Christoph "baka0815" Schwerdtfeger

    I created a patch for the uses-comment problem (https://sourceforge.net/p/gexperts/bugs/442/). If that (way) is accepted, I will adapt the changes in this patchset.

     

    Last edit: Christoph "baka0815" Schwerdtfeger 2025-08-15
  • Thomas Mueller

    Thomas Mueller - 2025-10-12

    I have applied the Uses list patch now and also refactored the code to reduce the length the CheckIndent method (which is still way too long) and removed several variables from that method that were only used within one case block. Please have a look what you need to change for the enum indentation to work with the new code and submit your patch again.

     
  • Thomas Mueller

    Thomas Mueller - 2026-03-21

    implemented in revision #5306

     

Log in to post a comment.

MongoDB Logo MongoDB