You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's possible to preserve the indent in the original yaml when
we Unmarshal to a yaml.Node, and the structure of the original
yaml allows us to guess the indent.
The two easiest cases are when we have a nested block-style mapping,
or a sequence inside a mapping and the sequence is indented. For
those, the node tells us the parsed column (starting at 1) and we
use that indent.
However: if we parse to some other data structure (as we do with
Kustomize) or the original yaml has some structure where the indentation
is unclear, eg:
root:
- unguessable indent
- deeper:
guessable: but requires deeper traversal
... then we just guess '2'.
This should generate _fewer_ useless whitespace changes, but cannot
prevent them all.
Signed-off-by: Brian Ewins <[email protected]>
0 commit comments