vscode-yaml-sort icon indicating copy to clipboard operation
vscode-yaml-sort copied to clipboard

Add possibility to add specific custom sorts to file association

Open jorneilander opened this issue 3 years ago • 1 comments

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.

jorneilander avatar Jun 12 '21 10:06 jorneilander

@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.

pascalre avatar Jun 22 '21 21:06 pascalre