cue icon indicating copy to clipboard operation
cue copied to clipboard

cue/format: excess indentation when importing yaml with --list

Open rogpeppe opened this issue 1 year ago • 0 comments

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

$ cue version
2c6ed18e253b33ffe423d6781d1e4b9ac80a5e83

Does this issue reproduce with the latest stable release?

Yes (v0.10.0)

What did you do?

exec cue export --list --out cue x.yaml
# Note: 9 tabs: 2 more than the expected indentation.
! stdout '									x'
-- x.yaml --
X0:
  X1: x
  X2:
    X3: x
    X4:
      X5:
        X6: x
        X7:
          X8:
            X9: |-
              x
              x
            X10: x
          X11: x

What did you expect to see?

A passing test. The indentation of the multiline string should not be more than one level more than its surrounding members.

What did you see instead?

> exec cue export --list --out cue x.yaml
[stdout]
[{
	X0: {
		X1: "x"
		X2: {
			X3: "x"
			X4: X5: {
				X6: "x"
				X7: {
					X8: {
						X9: """
									x
									x
									"""
						X10: "x"
					}
					X11: "x"
				}
			}
		}
	}
}]
# Note: 9 tabs: 2 more than the expected indentation. (0.000s)
> ! stdout '									x'
FAIL: /tmp/x.txtar:3: unexpected match for `									x` found in stdout: 									x

Note the indentation of the multiline string in X9. This was observable in many locations in a much larger example.

rogpeppe avatar Oct 15 '24 15:10 rogpeppe