Make alphabetical sorting the default (#32315)

Follow up of this pr: #25148

Release Notes:

- Improved file sorting.
As described in #20126, I was fed up with lexicographical file sorting
in the project panel. The current sorting behavior doesn't handle
numeric segments properly, leading to unintuitive ordering like
`file_1.rs`, `file_10.rs`, `file_2.rs`.


## Example Sorting Results
Using `lexicographical` (default):
```
.
├── file_01.rs
├── file_1.rs
├── file_10.rs
├── file_1025.rs
├── file_2.rs
```

Using alphabetical (natural) sorting:
```
.
├── file_1.rs
├── file_01.rs
├── file_2.rs
├── file_10.rs
├── file_1025.rs
```
This commit is contained in:
Tom Planche 2025-08-14 00:07:49 +02:00 committed by GitHub
parent 293992f5b1
commit e67b2da20c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 520 additions and 35 deletions

View file

@ -740,9 +740,9 @@ async fn test_editing_files(cx: &mut gpui::TestAppContext) {
" > .git",
" > a",
" v b",
" > [EDITOR: ''] <== selected",
" > 3",
" > 4",
" > [EDITOR: ''] <== selected",
" a-different-filename.tar.gz",
" > C",
" .dockerignore",
@ -765,10 +765,10 @@ async fn test_editing_files(cx: &mut gpui::TestAppContext) {
" > .git",
" > a",
" v b",
" > 3",
" > 4",
" > [PROCESSING: 'new-dir']",
" a-different-filename.tar.gz <== selected",
" > 3 <== selected",
" > 4",
" a-different-filename.tar.gz",
" > C",
" .dockerignore",
]
@ -782,10 +782,10 @@ async fn test_editing_files(cx: &mut gpui::TestAppContext) {
" > .git",
" > a",
" v b",
" > 3",
" > 3 <== selected",
" > 4",
" > new-dir",
" a-different-filename.tar.gz <== selected",
" a-different-filename.tar.gz",
" > C",
" .dockerignore",
]
@ -801,10 +801,10 @@ async fn test_editing_files(cx: &mut gpui::TestAppContext) {
" > .git",
" > a",
" v b",
" > 3",
" > [EDITOR: '3'] <== selected",
" > 4",
" > new-dir",
" [EDITOR: 'a-different-filename.tar.gz'] <== selected",
" a-different-filename.tar.gz",
" > C",
" .dockerignore",
]
@ -819,10 +819,10 @@ async fn test_editing_files(cx: &mut gpui::TestAppContext) {
" > .git",
" > a",
" v b",
" > 3",
" > 3 <== selected",
" > 4",
" > new-dir",
" a-different-filename.tar.gz <== selected",
" a-different-filename.tar.gz",
" > C",
" .dockerignore",
]
@ -837,12 +837,12 @@ async fn test_editing_files(cx: &mut gpui::TestAppContext) {
" > .git",
" > a",
" v b",
" > 3",
" v 3",
" [EDITOR: ''] <== selected",
" Q",
" > 4",
" > new-dir",
" [EDITOR: ''] <== selected",
" a-different-filename.tar.gz",
" > C",
]
);
panel.update_in(cx, |panel, window, cx| {
@ -863,12 +863,12 @@ async fn test_editing_files(cx: &mut gpui::TestAppContext) {
" > .git",
" > a",
" v b",
" > 3",
" v 3 <== selected",
" Q",
" > 4",
" > new-dir",
" a-different-filename.tar.gz <== selected",
" a-different-filename.tar.gz",
" > C",
" .dockerignore",
]
);
}