kubernetes-yaml-formatter icon indicating copy to clipboard operation
kubernetes-yaml-formatter copied to clipboard

Question: how to apply it to helm-template files?

Open RafalSkolasinski opened this issue 2 years ago • 2 comments

This is great, finally sane indent for list in Kubernetes / Ansible yaml files. Just a question - how can I make it also work if file is recognized as helm-template?

I tried to set

    "[helm-template]": {
        "editor.defaultFormatter": "kennylong.kubernetes-yaml-formatter"
    },

but VS Code still complains that "There is no formatter for 'helm' files installed.".

RafalSkolasinski avatar Feb 18 '23 13:02 RafalSkolasinski

I did it in this way:

  "[yaml]": {
    "editor.defaultFormatter": "kennylong.kubernetes-yaml-formatter",
    "editor.formatOnSave": true
  },
  "files.associations": {
    "*.yml": "yaml",
    "*.yaml": "yaml"
  },
  "editor.defaultFormatter": "esbenp.prettier-vscode",

pie-r avatar Feb 22 '23 14:02 pie-r

Hi!

Sorry for the delay.

I use helm very often. But since helm is not really yaml but a template-engine we cannot format the mixed two directly.

However, for the template part you can use builtin function like indentn.

for the yaml part, the new v2 version has implemented a range format, so just select range code and the extension will format those region.

longkai avatar Sep 21 '24 10:09 longkai

You can config with(which is the default value):

"[helm]": {
  "editor.defaultFormatter": "kennylong.kubernetes-yaml-formatter",
  "editor.formatOnSave": false
},
"[ansible]": {
  "editor.defaultFormatter": "kennylong.kubernetes-yaml-formatter",
  "editor.formatOnSave": false
}

longkai avatar Oct 26 '24 08:10 longkai