Closed jkjuopperi closed 7 months ago
I would prefer not adding a separate formatter plugin for each and every file type in the repository. That being said, YAML is so prevalent in the project and gives so much freedom in formatting that I think having a formatter for YAML would be a good idea. Then we can start fighting about how lists should be indented :) /joke
It occurs to me, that Prettier supports YAML and we already have the esbenp.prettier-vscode
recommended under frontend
. Could that same plugin be used to format in backend
despite it not being a Node.js project?
We could put the default formatter and also the YAML settings to workspace configuration.
Would it make sense to have the final newline and whitespace trim settings workspace wide also?
"settings": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"[yaml]": {
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.formatOnSave": true
}
},
"extensions": {
"recommendations": ["esbenp.prettier-vscode"]
}
Yes, it makes very much sense 👍
Use the default redhat.vscode-yaml plugin and set up formatting yaml files on save. This also trims the trailing whitespace.
Trimming trailing whitespace could be achieved with
"files.trimTrailingWhitespace": true
setting, but it likely makes sense to have automatic YAML formatting and fix indentation to two spaces.