Replace ProjectEntry struct with ProjectEntryId

Previously, we tracked the worktree_id and entry_id separately, but now that entry ids are unique across all worktrees this is unnecessary.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
This commit is contained in:
Nathan Sobo 2022-03-16 15:59:47 -06:00
parent a88320dc5f
commit 0036e5c86c
9 changed files with 126 additions and 126 deletions

View file

@ -842,8 +842,8 @@ impl Editor {
) -> ViewHandle<Editor> {
let project = workspace.project().clone();
if let Some(project_entry) =
project::File::from_dyn(buffer.read(cx).file()).and_then(|file| file.project_entry(cx))
if let Some(project_entry) = project::File::from_dyn(buffer.read(cx).file())
.and_then(|file| file.project_entry_id(cx))
{
return workspace
.open_item_for_project_entry(project_entry, cx, |cx| {

View file

@ -5,7 +5,7 @@ use gpui::{
View, ViewContext, ViewHandle, WeakModelHandle,
};
use language::{Bias, Buffer, Diagnostic, File as _};
use project::{File, Project, ProjectEntry, ProjectPath};
use project::{File, Project, ProjectEntryId, ProjectPath};
use std::fmt::Write;
use std::path::PathBuf;
use text::{Point, Selection};
@ -75,8 +75,8 @@ impl ItemView for Editor {
})
}
fn project_entry(&self, cx: &AppContext) -> Option<ProjectEntry> {
File::from_dyn(self.buffer().read(cx).file(cx)).and_then(|file| file.project_entry(cx))
fn project_entry_id(&self, cx: &AppContext) -> Option<ProjectEntryId> {
File::from_dyn(self.buffer().read(cx).file(cx)).and_then(|file| file.project_entry_id(cx))
}
fn clone_on_split(&self, cx: &mut ViewContext<Self>) -> Option<Self>