Tyriar / vscode-sort-lines

Visual Studio Code extension to sort lines of text
https://marketplace.visualstudio.com/items/Tyriar.sort-lines
MIT License
146 stars 42 forks source link

Feature request: Path sort #102

Closed TomGault closed 2 years ago

TomGault commented 2 years ago

Disclaimers:

  1. I fully realize that this might be feature creep.
  2. Perhaps this could be covered by #40? If so, this might be an interesting example to demonstrate #40 in the documentation.

I frequently find myself wanting to sort lists of file paths or globs and I'd really love a path-sort command that would list directories before the files.

Sorted:

aaa.txt
bbb
ccc/ddd.txt
eee/

Desired:

ccc/ddd.txt
eee/
aaa.txt
bbb

That is, I'd love a path sort command that would put some-text/ before some-text + (something other than /).

And perhaps a variant which sorted using Windows path-marks: \. (Note that one command can't automatically support both, because \ means something different in *nix paths).

Caveat: In the example above, technically bbb COULD be a directory, but the sorting algorithm couldn't reliably know so it should assume it's a file.

P.S. Thanks for an already VERY useful extension!

Tyriar commented 2 years ago

Yes I think this is a little niche so we'd want to support it through a general custom sorting mechanism as in https://github.com/Tyriar/vscode-sort-lines/issues/40

vkammerer commented 7 months ago

Is this feature really "niche"? This is how most filesystem UIs represent files order, isn't it?

I find myself having to move all the subdirectories files above the others after having sorted them, which quickly becomes quite tedious.

It seems to me that this could be the default behaviour (even though it would be a breaking change obviously).