vscode-yaml-sort
vscode-yaml-sort copied to clipboard
Add option to keep quotes
Could you add an option to just keep quotes as they are when sorting.
Example. parent_key: 'Pkey2 with space': k1: v1 k2: 'v2' 'Pkey1 with space': k1: 'v1' k2: v2
Would become: parent_key: Pkey1 with space: k1: v1 k2: v2 Pkey2 with space: k1: v1 k2: v2
What it should be if original quotes are ignored: parent_key: 'Pkey1 with space': k1: v1 k2: 'v2' 'Pkey2 with space': k1: 'v1' k2: v2
@pascalre ?
Yeah, I agree this is my only annoyance. This breaks my Ansible playbooks since some values need to be quoted, for example when you have a leading "{{".
@pascalre Is this project dead because you don't seem to react to issues?
Hello @Joris29, this project is not dead. But my time is limited. Feel free to contribute with a PR.
@pascalre Alright understandable I will try to do an attempt to create a PR for it but i have no knowledge of typescript but I guess I can learn it pretty fast
This is a reoccurrence of https://github.com/pascalre/vscode-yaml-sort/issues/142 which is partially resolved it's strange behaviour with quoting.
Using just single quotes or double quotes will change to nothing. Using double quotes inside single quotes like this ' "this is a text" ' will remain as it should. Using single quotes inside double quotes like this " 'this is a text' " will return three single quotes on each side
Very strange quoting behaviour but i will try to fix it
After doing some further research there is also another vscode extension for yaml validation which support sorting https://github.com/redhat-developer/yaml-language-server
@paulcalabro If you don't use the custom sorts it might be better to use that one for now. As the code is quite complex for me and it might take a while to have a working solution.
Seems like a lot of refactoring because the used library doesn't support it: https://github.com/nodeca/js-yaml/issues/711#issuecomment-1700532593
Thanks @Joris29 !