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

Add possibility for custom sort keys per file #137

Open
huxuan opened this issue Jun 8, 2023 · 3 comments
Open

Add possibility for custom sort keys per file #137

huxuan opened this issue Jun 8, 2023 · 3 comments
Labels
feature New feature or request

Comments

@huxuan
Copy link

huxuan commented Jun 8, 2023

Cases that we have many yaml files in a project. Use a global custom sort keys will lead to some kind of conflicts. It would be great if we can have that customization per file. Either a comment at the beginning of the file or a key-value settings for yaml sort extension with filename as key will both be OK for me.

@pascalre pascalre changed the title [Feature Request] Possible to have custom sort keys per file? Add possibility for custom sort keys per file Jun 11, 2023
@pascalre pascalre added the feature New feature or request label Aug 17, 2023
@huxuan
Copy link
Author

huxuan commented Dec 5, 2023

Hi @pascalre, any clues on implmenting this? For my user cases, I have several configuration files in yaml:

  • GitHub Action Workflows
  • GitHub Dependabot Configuration
  • GitLab CI/CD
  • Copier configuration
  • Copier answers
  • ReadTheDocs configuration
  • Pre-commit configuration

Generally, they all belong to some well-known tools that have some kind of convention for ordering. But with only one custom sort keys it tends to have conflicts and could be hard to maintain. One possible solution could be having the custome sort keys based on file name match in glob pattern for example. I would appreciate if there is anything I can do to help.

@pascalre
Copy link
Owner

pascalre commented Dec 8, 2023

@huxuan I committed a first draft to eb54197

I still got two problems here:

  1. As you can see in package.json, the filenames currently do not support wildcards.
  2. The contents of the map are not read correctly. Debugging at settings.ts line 36 shows me this content:
Bildschirmfoto 2023-12-08 um 22 26 55

The next command results in the error map.get is not a function

@huxuan
Copy link
Author

huxuan commented Dec 11, 2023

Thanks for the response, I will take a look and find out whether there is anything I can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants