Emacs-D-Mode-Maintainers / Emacs-D-Mode

An Emacs mode for D code.
GNU General Public License v3.0
84 stars 22 forks source link

enums with a base type incorrectly indent #19

Closed alexhairyman closed 4 years ago

alexhairyman commented 10 years ago

I don't know if this is a ccmode indentation I can change, but here's what goes wrong:

enum GCode_Command : string // set the base type to be string
{
  RLM = "G00", // this one indents correctly 
    FRM = "G01", // this doesn't 
    OFFR = "G42" // ditto for this one
}

in addition, there is no highlighting done for the enum members

russel commented 10 years ago

Indenting of the whole thing is bizarre for me:

enum GCode_Command : string // set the base type to be string
  {
    RLM = "G00", // this one indents correctly
      FRM = "G01", // this doesn't
      OFFR = "G42" // ditto for this one
      }
russel commented 10 years ago

With d-mode.el 53efec4d83c7cee8227597f010fe7fc400ff05f1 I find I get the following indentation by tabbing on each line:

enum GCode_Command : string // set the base type to be string
  {
    RLM = "G00", // this one indents correctly
    FRM = "G01", // this doesn't
    OFFR = "G42" // ditto for this one
    }

if I manually remove the spaces before the {, I get:

enum GCode_Command : string // set the base type to be string
{
  RLM = "G00", // this one indents correctly
  FRM = "G01", // this doesn't
  OFFR = "G42" // ditto for this one
  }

I guess the question is, is this now still a problem? (I suspect the answer is yes, but I have no idea what the solution is just now).

johbo commented 8 years ago

I am seeing sililar issues:

enum MyValues {
    a,
    b,
    c
}

enum OtherValues {
    a = 2,
    b = 4,
    c
}

enum OtherValues2 : uint {
    a = 2u,
        b = 4u,
        c
        }

Seems it is recognized as a different thing. In the first two cases hitting C-c C-s tells me that it is a brace-list-entry, in the last case it tells me that it is a statement-cont. (tried the second entry of each)

I am not too familiar with cc-mode / d-mode yet unfortunately, but maybe it is "just" a matter of configuring it so that it recognizes both as the same thing or of adjusting my style configuration, so that in both cases the result is the same?

ghost commented 6 years ago

Is there any update or workaround on this?

nordlow commented 6 years ago

Further, the syntax highlighting of the enumerators gets ruined for me aswell

enum OtherValues2 : uint {
    a = 2u,
        b = 4u,
        c
        }

...