cuelang / cue

CUE has moved to https://github.com/cue-lang/cue
https://cuelang.org
Apache License 2.0
3.09k stars 171 forks source link

cmd/cue: fmt indents too much sometimes #1018

Closed uhthomas closed 3 years ago

uhthomas commented 3 years ago

What version of CUE are you using (cue version)?

$ cue version
cue version v0.4.0 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What did you do?

Format the following CUE source:

names: {
    categories: [
        "prometheus-operator",
    ]
        kind:     "ThanosRuler"
        listKind: "ThanosRulerList"
        plural:   "thanosrulers"
        singular: "thanosruler"
}, scope: "Namespaced"

What did you expect to see?

No change -- having scope positioned like that is weird for sure though. This is because of https://github.com/cuelang/cue/issues/826

What did you see instead?

names: {
    categories: [
        "prometheus-operator",
    ]
        kind:     "ThanosRuler"
        listKind: "ThanosRulerList"
        plural:   "thanosrulers"
        singular: "thanosruler"
}, scope: "Namespaced"
myitcv commented 3 years ago

Likely related/identical to https://github.com/cuelang/cue/issues/1006

uhthomas commented 3 years ago

Looks like it's actually even more common than I had first thought. Take this snippet:

// Some comment
some_long_key: "some_value"

Formatting results in

        // Some comment
some_long_key: "some_value"

Is this a regression? I don't remember seeing such behavior before.

cueckoo commented 3 years ago

This issue has been migrated to https://github.com/cue-lang/cue/issues/1018.

For more details about CUE's migration to a new home, please see https://github.com/cue-lang/cue/issues/1078.