# Use numeric sorting if possible in project panel \(\#8486\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/ac31c824e4eeb0468c375002a117111c1c895235)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: ac31c824e4eeb0468c375002a117111c1c895235

Requested commit: ac31c824e4eeb0468c375002a117111c1c895235

Commit: ac31c824e4eeb0468c375002a117111c1c895235

Tree: a2d1dec35cfa34b9db3a50201007797d321cabc2

Author: Thorsten Ball

Committer: GitHub

## Message

```
Use numeric sorting if possible in project panel (#8486)

Previously, if you had the following files/folders in your project

    1-abc
    10
    11-def
    ...
    2
    21-abc

that's how we'd display them.

With this change, we now try to parse them as numbers, if possible, and
use that to sort. If we can't parse a component as a number, we fall
back to normal string comparison.

End result is this:

    1-abc
    2
    10
    11-def
    ...
    21-abc


Release Notes:

- Fixed filenames with numeric components (`1.txt`, `1/one.txt`, ...)
not being sorted as numbers, but as string.

Before:

![screenshot-2024-02-27-18 29
43@2x](https://github.com/zed-industries/zed/assets/1185253/2d223126-329f-4ae7-9a12-d33e2c3fe52f)


After:

![after](https://github.com/zed-industries/zed/assets/1185253/f4f98fa0-e66f-40aa-aa28-189143cbb75f)

---------

Co-authored-by: Marshall <marshall@zed.dev>
```

## Parents

- [3036c0cab773b7ae621c726dbab3d8532d6cd01b](https://git.cafe/gitcafe/zed/commit/3036c0cab773b7ae621c726dbab3d8532d6cd01b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/ac31c824e4eeb0468c375002a117111c1c895235?format=markdown)
