Skip to content

Broken/unexpected formatting of comments after members #2279

Open
@milesziemer

Description

@milesziemer
  1. Trailing comments get moved to a weird spot:
structure A {
    a: String // a
}

becomes

structure A {
    a: String

    // a
}
  1. With default value assignments, you get an extra newline if you had a trailing comment in the shape body:
structure A {
    a: String = ""
    // a
}

becomes:

structure A {
    a: String = ""

    // a

}
  1. Invalid doc comments also aren't fixed if they come after a default value assignment:
structure A {
    a: String = "" /// a
}

structure B {
    b: String = ""
    /// a
}

don't change.

Not sure about 1, but for 2 and 3, it has something to do with the fact that ValueAssignment contains all whitespace following it (through BR)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions