osimek1 / intellij-code-blocks-sorter

MIT License
4 stars 1 forks source link

It yaml sorted by this package? #14

Closed gustawdaniel closed 5 years ago

osimek1 commented 5 years ago

Yes it is, it is language independent - I have use it with yaml, json, javascript, typescript, coffeescritp, php, Java.

As you can see there are some small issues but at the moment I have no time to maintanace it, I hope that I'll take care of it soon.

Why are you asking? Have you found some bug?

gustawdaniel commented 5 years ago

Not bug. I did not tested it before asking. I was considering scenario:

a: 
  d: "value"
  c: "value"
b: 
  e: "value"

And wanted to obtain

a: 
  c: "value"
  d: "value"
b: 
  e: "value"

Simple sorting lines should give

a: 
b: 
  c: "value"
  d: "value"
  e: "value"

and this is not valid YAML. I didn't know that this package is smart enough, because docs not specify that yaml is sorted correctly.

osimek1 commented 5 years ago

It will work with that tool, unfortunately at the moment we are sorting only "first level" - I mean that if you select your part of code and use sort option it will sort "a" and "b" properties, then you have to select code with "c" and "d" and it will sort next part of code.

If you want to do it with one click have to wait (please watch list of issues there is a task "add deep sort" or something like that) or contribute to that plugin

Current implementation is usable when you want to sort eg. Methods in the class by name - it will not change you code, only order of the methods will be changed.