xls icon indicating copy to clipboard operation
xls copied to clipboard

Inline comments on enums values are moved

Open hzeller opened this issue 1 year ago • 1 comments

A very common way to document enums is to add EOL comments to the constants:

bazel-bin/xls/dslx/dslx_fmt - <<EOF
enum Foo : u8 {
  X = u8:1,  // Description of X
  Y = u8:2,  // Description of Y
  Z = u8:3,  // Description of Z
}
EOF

... after formatting, the outcome is less helpful:

enum Foo : u8 {
    X = u8:1,
    // Description of X
    Y = u8:2,
    // Description of Y
    Z = u8:3,
    // Description of Z
}

hzeller avatar Jan 31 '24 00:01 hzeller

It should have been putting them /before/ the item, but also we have support for inline comments on struct field members, need to factor out the handling so it's common to all "member items" definitions.

cdleary avatar Jan 31 '24 18:01 cdleary