use std::sync::Arc; use gpui::{App, Entity, SharedString, WeakEntity, Window}; use ui::layout::panel::{Panel, PanelView}; use crate::app::AppRoot; /// Opens a repository in the main panel, reusing its tab when it is already open. pub fn open_primary
(
workspace: &WeakEntity + 'static,
{
let id = id.into();
if workspace
.read_with(cx, |app, cx| app.panel().read(cx).has(&id))
.unwrap_or(false)
{
if let Err(error) = workspace.update(cx, |app, cx| app.activate_main(&id, cx)) {
log::warn!("failed to activate panel {id}: {error}");
}
return;
}
let view: Arc (
workspace: &WeakEntity + 'static,
{
let id = id.into();
if workspace
.read_with(cx, |app, cx| app.panel().read(cx).has(&id))
.unwrap_or(false)
{
return;
}
let view: Arc