Skip to content
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

chore: YAML format on save #420

Merged
merged 2 commits into from
Feb 9, 2024
Merged

Conversation

jkjuopperi
Copy link
Contributor

@jkjuopperi jkjuopperi commented Feb 8, 2024

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.

@jkjuopperi jkjuopperi requested a review from japsu February 8, 2024 12:24
@japsu
Copy link
Contributor

japsu commented Feb 8, 2024

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?

@jkjuopperi
Copy link
Contributor Author

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"]
  }

@japsu
Copy link
Contributor

japsu commented Feb 8, 2024

Yes, it makes very much sense 👍

@japsu japsu merged commit c92bdc8 into con2:main Feb 9, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants