Fix worktree ordering with PathList (#39944)

The recent introduction of PathList removed some of the ordering logic
resulting in paths always being alphabetised.

This change restores the previous logic for sorting worktrees in a
project using the newer PathList type.

Closes #39934

Release Notes:

- Fixed manual worktree reordering

<details>

<summary>Screen recording of it retaining the order</summary>


https://github.com/user-attachments/assets/0197d118-6ea7-4d2d-8fec-c917fcb9d277

</details>

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
This commit is contained in:
Elliot Thomas
2025-10-13 12:41:42 +02:00
committed by GitHub
co-authored by MrSubidubi
parent f6630ed736
commit 237474a889
5 changed files with 85 additions and 15 deletions
@@ -311,8 +311,7 @@ impl PickerDelegate for RecentProjectsDelegate {
.filter(|(_, (id, _, _))| !self.is_current_workspace(*id, cx))
.map(|(id, (_, _, paths))| {
let combined_string = paths
.paths()
.iter()
.ordered_paths()
.map(|path| path.compact().to_string_lossy().into_owned())
.collect::<Vec<_>>()
.join("");
@@ -462,8 +461,7 @@ impl PickerDelegate for RecentProjectsDelegate {
let mut path_start_offset = 0;
let (match_labels, paths): (Vec<_>, Vec<_>) = paths
.paths()
.iter()
.ordered_paths()
.map(|p| p.compact())
.map(|path| {
let highlighted_text =