Remove workspace::Item trait

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Keith Simmons <keith@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
Max Brunsfeld
2022-03-16 13:34:06 -07:00
co-authored by Nathan Sobo Keith Simmons Antonio Scandurra
parent e8efaed1b2
commit a88320dc5f
10 changed files with 281 additions and 517 deletions
+10
View File
@@ -3221,6 +3221,16 @@ impl Project {
self.active_entry
}
pub fn entry_for_path(&self, path: &ProjectPath, cx: &AppContext) -> Option<ProjectEntry> {
self.worktree_for_id(path.worktree_id, cx)?
.read(cx)
.entry_for_path(&path.path)
.map(|entry| ProjectEntry {
worktree_id: path.worktree_id,
entry_id: entry.id,
})
}
// RPC message handlers
async fn handle_unshare_project(
+9
View File
@@ -1,3 +1,5 @@
use crate::ProjectEntry;
use super::{
fs::{self, Fs},
ignore::IgnoreStack,
@@ -1502,6 +1504,13 @@ impl File {
pub fn worktree_id(&self, cx: &AppContext) -> WorktreeId {
self.worktree.read(cx).id()
}
pub fn project_entry(&self, cx: &AppContext) -> Option<ProjectEntry> {
self.entry_id.map(|entry_id| ProjectEntry {
worktree_id: self.worktree_id(cx),
entry_id,
})
}
}
#[derive(Clone, Debug, PartialEq, Eq)]