cue/format: collapse empty structs/lists to single line
This changes the cue formatting logic to always format an empty
struct on a single line.
The following cue:
struct: {
}
list: [
]
Will now be formatted like so:
struct: {}
list: []
Note that we preserve the multi-line structure in case a comment is
present in an empty list/struct. For example:
struct: {
// some comment
}
will be formatted as-is.
Fixes #278.
Signed-off-by: Noam Dolovich <noam.tzvi.dolovich@gmail.com>
Change-Id: I8ab8b7975d374e25b9fba8e02d53f643020b793b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1193759
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
authored by