atom / tree-view

🌳 Explore and open project files in Atom
MIT License
560 stars 365 forks source link

Numbers are sorted before punctuation marks. #620

Closed sftd closed 8 years ago

sftd commented 8 years ago

When files and folders are sorted in files list the order is following:

  1. numbers
  2. punctuation marks
  3. letters

I think the right order should be:

  1. punctuation marks
  2. numbers
  3. letters

Recently I started project where I have a few folder with names starting with number and as I'm using git for it the order is following:

It's a little bit unintuitive for me. I would prefer to have .git folder on top.

Windows 8.1, Atom 1.0.19, tree-view 0.187.0

screen

billybonks commented 8 years ago

struggling to recreate that sort order. perhaps it can be changed that files take precedence over folders,

screen shot 2015-10-25 at 9 35 55 pm
sftd commented 8 years ago

Ok... For some reason tree-view version in my Atom i stuck on 0.187.0 and doesn't update any further. I will report if problem still exist when I will manage to update tree-view.

Edit: My guess would be that Atom core packages are only updated when Atom core is updated. As I wasn't aware of that my issue is probably outdated (at least according to @billybonks comment).

billybonks commented 8 years ago

might be because i'm using the atom beta.

Tyriar commented 8 years ago

Reproduced on Atom v1.0.19 and tree-view v0.187.0. Could this have something to do with the natural sort change that was reverted in 0.194.0 for performance reasons? https://github.com/atom/tree-view/commit/3ef7d75b82b3f16188858d152a977b7739ebfb3a https://github.com/atom/tree-view/commit/ca1d1f60e519ad646733802b466ba800488a8ae7

Tyriar commented 8 years ago

Confirmed that javascript-natural-sort which is now reverted is what was causing the issue.

$ node
> var ns = require('javascript-natural-sort')
undefined
> ns
[Function: naturalSort]
> ['1', '.', 'a', 'A'].sort(ns)
[ '1', '.', 'A', 'a' ]
> ['.gitignore', '1', 'a', 'A'].sort(ns)
[ '1',
  '.gitignore',
  'A',
  'a' ]

This issue is probably safe to be closed.