Properly handle WorktreeId
This commit is contained in:
parent
34b0d6200f
commit
3984cc6d39
2 changed files with 4 additions and 4 deletions
|
@ -265,7 +265,7 @@ impl PickerDelegate for FileFinderDelegate {
|
||||||
.map(|(i, history_item)| PathMatch {
|
.map(|(i, history_item)| PathMatch {
|
||||||
score: i as f64,
|
score: i as f64,
|
||||||
positions: Vec::new(),
|
positions: Vec::new(),
|
||||||
worktree_id: history_item.worktree_id.0,
|
worktree_id: history_item.worktree_id.to_usize(),
|
||||||
path: Arc::clone(&history_item.path),
|
path: Arc::clone(&history_item.path),
|
||||||
path_prefix: "".into(),
|
path_prefix: "".into(),
|
||||||
distance_to_relative_ancestor: usize::MAX,
|
distance_to_relative_ancestor: usize::MAX,
|
||||||
|
@ -870,7 +870,7 @@ mod tests {
|
||||||
let worktree_id = cx.read(|cx| {
|
let worktree_id = cx.read(|cx| {
|
||||||
let worktrees = workspace.read(cx).worktrees(cx).collect::<Vec<_>>();
|
let worktrees = workspace.read(cx).worktrees(cx).collect::<Vec<_>>();
|
||||||
assert_eq!(worktrees.len(), 1);
|
assert_eq!(worktrees.len(), 1);
|
||||||
WorktreeId(worktrees[0].id())
|
WorktreeId::from_usize(worktrees[0].id())
|
||||||
});
|
});
|
||||||
|
|
||||||
// When workspace has an active item, sort items which are closer to that item
|
// When workspace has an active item, sort items which are closer to that item
|
||||||
|
@ -975,7 +975,7 @@ mod tests {
|
||||||
let worktree_id = cx.read(|cx| {
|
let worktree_id = cx.read(|cx| {
|
||||||
let worktrees = workspace.read(cx).worktrees(cx).collect::<Vec<_>>();
|
let worktrees = workspace.read(cx).worktrees(cx).collect::<Vec<_>>();
|
||||||
assert_eq!(worktrees.len(), 1);
|
assert_eq!(worktrees.len(), 1);
|
||||||
WorktreeId(worktrees[0].id())
|
WorktreeId::from_usize(worktrees[0].id())
|
||||||
});
|
});
|
||||||
|
|
||||||
// Open and close panels, getting their history items afterwards.
|
// Open and close panels, getting their history items afterwards.
|
||||||
|
|
|
@ -58,7 +58,7 @@ use sum_tree::{Bias, Edit, SeekTarget, SumTree, TreeMap, TreeSet};
|
||||||
use util::{paths::HOME, ResultExt, TakeUntilExt, TryFutureExt};
|
use util::{paths::HOME, ResultExt, TakeUntilExt, TryFutureExt};
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, PartialOrd, Ord)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, PartialOrd, Ord)]
|
||||||
pub struct WorktreeId(pub usize);
|
pub struct WorktreeId(usize);
|
||||||
|
|
||||||
pub enum Worktree {
|
pub enum Worktree {
|
||||||
Local(LocalWorktree),
|
Local(LocalWorktree),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue