Finish refactoring of how editors are opened

This commit is contained in:
Antonio Scandurra 2022-03-17 11:29:46 +01:00
parent 728c708150
commit aced1e2315
12 changed files with 96 additions and 260 deletions

View file

@ -253,12 +253,12 @@ impl Pane {
let pane = pane.downgrade();
let task = workspace.load_path(project_path, cx);
cx.spawn(|workspace, mut cx| async move {
let item = task.await;
let task = task.await;
if let Some(pane) = pane.upgrade(&cx) {
if let Some(item) = item.log_err() {
if let Some((project_entry_id, build_item)) = task.log_err() {
pane.update(&mut cx, |pane, cx| {
pane.nav_history.borrow_mut().set_mode(mode);
pane.open_item(item, cx);
let item = pane.open_item(project_entry_id, cx, build_item);
pane.nav_history
.borrow_mut()
.set_mode(NavigationMode::Normal);
@ -280,7 +280,7 @@ impl Pane {
}
}
pub(crate) fn open_editor(
pub(crate) fn open_item(
&mut self,
project_entry_id: ProjectEntryId,
cx: &mut ViewContext<Self>,
@ -299,14 +299,6 @@ impl Pane {
item_view
}
pub fn open_item(
&mut self,
item_view_to_open: Box<dyn ItemViewHandle>,
cx: &mut ViewContext<Self>,
) {
self.add_item(None, item_view_to_open.boxed_clone(), cx);
}
pub(crate) fn add_item(
&mut self,
project_entry_id: Option<ProjectEntryId>,