pascalre / vscode-yaml-sort

This VS Code extension exposes the possibility to sort, format and validate yaml files.
https://marketplace.visualstudio.com/items?itemName=PascalReitermann93.vscode-yaml-sort
MIT License
41 stars 3 forks source link

Add possibility to add specific custom sorts to file association #32

Open jorneilander opened 3 years ago

jorneilander commented 3 years ago

I have FluxCD project which incorporates a lot of YAML files which require a lot more than three custom sort sets to properly manage. It would be awesome to add some pre-defined and/or array of custom sorts and specifically reference them via file name.

Example, the .pre-commit.yaml gets butchered, from:

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.0.1
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
        args: [--allow-multiple-documents, --unsafe]
      - id: check-added-large-files

to:

repos:
  - hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - args:
          - '--allow-multiple-documents'
          - '--unsafe'
        id: check-yaml
      - id: check-added-large-files
    repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.0.1

But the repositoy also contains kustomization-files, K8S-files, Home Assistant-files, and some others. They all carry their own best practices in terms of readable sorting.

pascalre commented 3 years ago

@jorneilander I think it's definitely a good idea to have more than three custom sorts, but I don't know yet how to implement it. Adding custom sort command based on a users configuration is (currently) not possible, because every command has to be exposed in package.json.