-
Notifications
You must be signed in to change notification settings - Fork 228
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
Add Config for Array Indentation Spacing #172
Comments
Hi, any plans to add this config? |
+1 on this one |
This all depends on prettier adding this configuration or seeing if they have some api that allows to change array configuration. |
And per prettier/prettier#4723, Prettier is decided to stay at |
+1 for this, my dev teams preferred option is not to indent |
+1 for this. :) |
Also need this option |
Another +1 |
Also an issue when using This means that currently, the VS Code formatting plugin and the |
Maybe a workable option could be to allow changing the formatter plugin? E.g. yamlfmt (CLI wrapper for https://sourceforge.net/projects/ruamel-yaml/)? Don't know if the exact tool is a good suggestion or not. |
Same for the YAML files edited and committed by Flux v2 image-automation-controller. They've pinpointed it to the behaviour of the underlying library (kyaml) that is also used by kustomize. yamllint has a configurable setting for sequences indentation ( Prettier's decision to enforce a particular style of sequence indentation is questionable to be honest. Automated tools aside, there are plenty of YAML files using non-indented sequences, particularly in the Kubernetes ecosystem. |
Same issue here +1 |
So, I gave it a try and despite Prettier community deciding against using this style, I hope they would agree to make this an option. Please support my PR prettier/prettier#10927 Once/if the PR merges and releases we can just simply update prettier and enable the flag here. 🙂 2. (#519, redhat-developer/yaml-language-server#471) |
+1 for this. |
@tumido great work, I'd love to see your PR being merged into prettier. |
Hi, has there been any progress on this? Or known workaround... I was trying to disable |
Same as above, wonder if there is any update here? |
redhat-developer#172) * Fix issue: Array item properties are created with the wrong indent #redhat-developer#192 Signed-off-by: andxu <[email protected]>
+1 for this. |
+1 please provide an option for me to config |
The path forward is to extend prettierx and then use it instead of prettier? Normally, I might advocate for extending prettier via prettier-plugin-x, but prettier's philosophical tenet that their opinion cannot be configured seems incompatible with the needs of a yaml plugin for vscode. |
To be honest I am against making non-indented default. I am more than ok with them indented (prettier default). For example on Ansible ecosystem that is also the standard and there are good reasons for it related to visibility/readability. |
Ansible is using non-intented format for yamls in many places? Just for example on this snippet in docs here https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html we have
To be clear, I am not against indented lists. Just not in all context. It should be customizable and everyone will be happy :) |
@ssbarnea the selection of a default is a different question. The intent as stated in the title is to add config in order to support the style baked into kustomize and used by a rapidly growing community of Kubernetes users. |
Do we have any hope on resolving this any time soon? This makes the extension unusable for k8s-related development. |
might be worth making an option for which backend formatted to use? There are two camps here, and both are correct. There are the prettier people and the ansible people. Maybe something like: "yaml.formatting.engine": "prettier", or "yaml.formatting.engine": "pyyaml", if I get some time maybe I might take a stab at doing this |
@blairham Ansible people group decided to become prettier, so basically the groups you are talking about are more likely named: pyyaml and everyone else ;) While ansible-lint is making use of pyyaml, it does override its default config in order to make it compatible with prettier rules. Sadly the documentation does not specify this, but we are working on improving it. Joke aside, I am not against adding a configuration option, but it should be named |
@ssbarnea I agree that style is better nomenclature for the option, however, in that case I would omit The important thing is to provide an option. Does the prettierx approach have potential? |
+1 on this one |
now i find a new plugin:kubernetes-yaml-formatter |
+1 Was this issue addressed in the end? |
@mzylak83 sadly it was not. This extension relies on Prettier for YAML formatting. Therefore, to make this formatting possible here, we need to add the functionality in upstream Prettier first. And Prettier seems to have decided not to merge my PR for it, see prettier/prettier#10927 for details. |
Thank you, I can finally ditch this plugin as they are unwilling to work with the community |
@blairham, as mentioned numerous time on this issue, including the comment right above yours, this extension is not responsible for the formatting, it uses prettier and they don't want to include the option. kubernetes-yaml-formatter is a great extension and I use it myself, but I highly suggest keeping both as the former only deals with formatting, while vscode-yaml does so much more: auto-completion, highlighting, validation, etc. Just turn off the formatting on vscode-yaml and use kubernetes-yaml-formatter for that purpose. |
They own the extension and can provide other formatters or even use the PyYAML package and set the defaults to that of prettier. That is what everyone is asking for instead of relying on a very opinionated formatting tool that does not meet everyone's needs and is not configurable. Thankfully someone has stepped up to the plate and provided that. |
We do recognize the problem with the formatter. We have tried to adopt the back-then-popular option prettier on this extension, and we have ended up with the issues we have right now. The As evidenced by the number of contributors to the projects, if the community wants to step in and help, we do welcome PRs, as well as issues. |
+1 |
+1 as https://github.com/transcend-io/terragrunt-atlantis-config do not indent list, and it is essential in a terragrunt-atlantis workflow |
+1 |
I worked around the problem by adding this vscode extension and disabling the setting |
+1 - there are IDE specific solutions for working around it, but it is annoying if different people use different ides, specially if i'm working on 20+ repos |
I'm working with Jekyll for GitHub Pages, which uses the Ruby gem for parsing YAML. This gem prefers this spacing in Arrays:
However, when auto-formatter is on, this gets converted to:
Regardless of preference, it would be great to have an option to disable adding space indention for arrays.
The text was updated successfully, but these errors were encountered: