-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v3: (Encoder) setting indentation for sequences #661
Comments
In v3 the indentation has been changed and no option to revert to a v2 like output is provided. Voices have already raised this problem, see :
But so far the maintainer does not seem to be inclined to either revert to the v2 formatting (that we all know about) or at least provide a way to configure the it. |
Indeed, at least not at this time we won't have an API in v3 for that, and the reason is that v3 makes The formatting in v2 |
The formatting in v2 was inconsistent in several ways with many edge cases. In v3 we've changed it to simply make it not special: every depth level is indented by the space amount of spacing, regardless of its type. I understand that some people will be used to the old formatting, but on this basis alone it'd be hard to evolve anything. |
- yaml.v3 author refuses to support special indentation for sequences; adjust tests containing arrays to indent. (see also: go-yaml/yaml#661)
- yaml.v3 author refuses to support special indentation for sequences; adjust tests containing arrays to indent. (see also: go-yaml/yaml#661)
- yaml.v3 author refuses to support special indentation for sequences; adjust tests containing arrays to indent. (see also: go-yaml/yaml#661)
- yaml.v3 author refuses to support special indentation for sequences; adjust tests containing arrays to indent. (see also: go-yaml/yaml#661)
- yaml.v3 author refuses to support special indentation for sequences; adjust tests containing arrays to indent. (see also: go-yaml/yaml#661)
- yaml.v3 author refuses to support special indentation for sequences; adjust tests containing arrays to indent. (see also: go-yaml/yaml#661)
- yaml.v3 author refuses to support special indentation for sequences; adjust tests containing arrays to indent. (see also: go-yaml/yaml#661)
- yaml.v3 author refuses to support special indentation for sequences; adjust tests containing arrays to indent. (see also: go-yaml/yaml#661)
With yaml.v3 it appears the formatting has changed and there's no way to revert back to the previous implementation. See go-yaml/yaml#661. Because of this, the easiest thing we can do is refresh the files to match the v3 output.
Heya ..amateur gopher here so go easy on me please..
I'm looking at the code on https://github.com/wangkuiyi/yamlfmt which is using v3
With a (eg stdout) stream I can see how the code uses an
Encoder
which is great, and I can easily see how the indent is modified via: https://pkg.go.dev/gopkg.in/yaml.v3#Encoder.SetIndentWhat I'm trying todo however is set the indent level for the list/items.. EG:
currently:
but I'd like a more compact:
I cannot see any such receiver function on the
*Encoder
so I'm not certain how to do this am I missing something or is it just not implemented?The text was updated successfully, but these errors were encountered: