mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 19:25:33 +03:00
Remove open_item_in_pane
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com> Co-Authored-By: Keith Simmons <keith@the-simmons.net>
This commit is contained in:
parent
0036e5c86c
commit
1f9885ec42
@ -256,16 +256,16 @@ impl Pane {
|
||||
let item = task.await;
|
||||
if let Some(pane) = pane.upgrade(&cx) {
|
||||
if let Some(item) = item.log_err() {
|
||||
workspace.update(&mut cx, |workspace, cx| {
|
||||
pane.update(cx, |p, _| p.nav_history.borrow_mut().set_mode(mode));
|
||||
let item_view = workspace.open_item_in_pane(item, &pane, cx);
|
||||
pane.update(cx, |p, _| {
|
||||
p.nav_history.borrow_mut().set_mode(NavigationMode::Normal)
|
||||
});
|
||||
|
||||
pane.update(&mut cx, |pane, cx| {
|
||||
pane.nav_history.borrow_mut().set_mode(mode);
|
||||
let item = pane.open_item(item, cx);
|
||||
pane.nav_history
|
||||
.borrow_mut()
|
||||
.set_mode(NavigationMode::Normal);
|
||||
if let Some(data) = entry.data {
|
||||
item_view.navigate(data, cx);
|
||||
item.navigate(data, cx);
|
||||
}
|
||||
item
|
||||
});
|
||||
} else {
|
||||
workspace
|
||||
|
@ -658,14 +658,12 @@ impl Workspace {
|
||||
) -> Task<Result<Box<dyn ItemViewHandle>, Arc<anyhow::Error>>> {
|
||||
let load_task = self.load_path(path, cx);
|
||||
let pane = self.active_pane().clone().downgrade();
|
||||
cx.spawn(|this, mut cx| async move {
|
||||
cx.as_mut().spawn(|mut cx| async move {
|
||||
let item = load_task.await?;
|
||||
this.update(&mut cx, |this, cx| {
|
||||
let pane = pane
|
||||
.upgrade(cx)
|
||||
.ok_or_else(|| anyhow!("could not upgrade pane reference"))?;
|
||||
Ok(this.open_item_in_pane(item, &pane, cx))
|
||||
})
|
||||
let pane = pane
|
||||
.upgrade(&cx)
|
||||
.ok_or_else(|| anyhow!("could not upgrade pane reference"))?;
|
||||
Ok(pane.update(&mut cx, |pane, cx| pane.open_item(item, cx)))
|
||||
})
|
||||
}
|
||||
|
||||
@ -836,16 +834,8 @@ impl Workspace {
|
||||
item_view: Box<dyn ItemViewHandle>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Box<dyn ItemViewHandle> {
|
||||
self.open_item_in_pane(item_view, &self.active_pane().clone(), cx)
|
||||
}
|
||||
|
||||
pub fn open_item_in_pane(
|
||||
&mut self,
|
||||
item_view: Box<dyn ItemViewHandle>,
|
||||
pane: &ViewHandle<Pane>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Box<dyn ItemViewHandle> {
|
||||
pane.update(cx, |pane, cx| pane.open_item(item_view, cx))
|
||||
self.active_pane()
|
||||
.update(cx, |pane, cx| pane.open_item(item_view, cx))
|
||||
}
|
||||
|
||||
pub fn open_item_for_project_entry<T, F>(
|
||||
|
Loading…
Reference in New Issue
Block a user