Remove and add more todosmerge .
This commit is contained in:
parent
f1fc07de94
commit
1a0cd3e09b
5 changed files with 468 additions and 467 deletions
|
@ -226,9 +226,9 @@ impl Dock {
|
||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn active_panel_index(&self) -> usize {
|
pub fn active_panel_index(&self) -> usize {
|
||||||
// self.active_panel_index
|
self.active_panel_index
|
||||||
// }
|
}
|
||||||
|
|
||||||
pub(crate) fn set_open(&mut self, open: bool, cx: &mut ViewContext<Self>) {
|
pub(crate) fn set_open(&mut self, open: bool, cx: &mut ViewContext<Self>) {
|
||||||
if open != self.is_open {
|
if open != self.is_open {
|
||||||
|
@ -241,84 +241,87 @@ impl Dock {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn set_panel_zoomed(&mut self, panel: &AnyView, zoomed: bool, cx: &mut ViewContext<Self>) {
|
// todo!()
|
||||||
// for entry in &mut self.panel_entries {
|
// pub fn set_panel_zoomed(&mut self, panel: &AnyView, zoomed: bool, cx: &mut ViewContext<Self>) {
|
||||||
// if entry.panel.as_any() == panel {
|
// for entry in &mut self.panel_entries {
|
||||||
// if zoomed != entry.panel.is_zoomed(cx) {
|
// if entry.panel.as_any() == panel {
|
||||||
// entry.panel.set_zoomed(zoomed, cx);
|
// if zoomed != entry.panel.is_zoomed(cx) {
|
||||||
// }
|
// entry.panel.set_zoomed(zoomed, cx);
|
||||||
// } else if entry.panel.is_zoomed(cx) {
|
|
||||||
// entry.panel.set_zoomed(false, cx);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// cx.notify();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn zoom_out(&mut self, cx: &mut ViewContext<Self>) {
|
|
||||||
// for entry in &mut self.panel_entries {
|
|
||||||
// if entry.panel.is_zoomed(cx) {
|
|
||||||
// entry.panel.set_zoomed(false, cx);
|
|
||||||
// }
|
// }
|
||||||
|
// } else if entry.panel.is_zoomed(cx) {
|
||||||
|
// entry.panel.set_zoomed(false, cx);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// pub(crate) fn add_panel<T: Panel>(&mut self, panel: View<T>, cx: &mut ViewContext<Self>) {
|
// cx.notify();
|
||||||
// let subscriptions = [
|
// }
|
||||||
// cx.observe(&panel, |_, _, cx| cx.notify()),
|
|
||||||
// cx.subscribe(&panel, |this, panel, event, cx| {
|
|
||||||
// if T::should_activate_on_event(event) {
|
|
||||||
// if let Some(ix) = this
|
|
||||||
// .panel_entries
|
|
||||||
// .iter()
|
|
||||||
// .position(|entry| entry.panel.id() == panel.id())
|
|
||||||
// {
|
|
||||||
// this.set_open(true, cx);
|
|
||||||
// this.activate_panel(ix, cx);
|
|
||||||
// cx.focus(&panel);
|
|
||||||
// }
|
|
||||||
// } else if T::should_close_on_event(event)
|
|
||||||
// && this.visible_panel().map_or(false, |p| p.id() == panel.id())
|
|
||||||
// {
|
|
||||||
// this.set_open(false, cx);
|
|
||||||
// }
|
|
||||||
// }),
|
|
||||||
// ];
|
|
||||||
|
|
||||||
// let dock_view_id = cx.view_id();
|
pub fn zoom_out(&mut self, cx: &mut ViewContext<Self>) {
|
||||||
// self.panel_entries.push(PanelEntry {
|
for entry in &mut self.panel_entries {
|
||||||
// panel: Arc::new(panel),
|
if entry.panel.is_zoomed(cx) {
|
||||||
// // todo!()
|
entry.panel.set_zoomed(false, cx);
|
||||||
// // context_menu: cx.add_view(|cx| {
|
}
|
||||||
// // let mut menu = ContextMenu::new(dock_view_id, cx);
|
}
|
||||||
// // menu.set_position_mode(OverlayPositionMode::Local);
|
}
|
||||||
// // menu
|
|
||||||
// // }),
|
|
||||||
// _subscriptions: subscriptions,
|
|
||||||
// });
|
|
||||||
// cx.notify()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn remove_panel<T: Panel>(&mut self, panel: &View<T>, cx: &mut ViewContext<Self>) {
|
pub(crate) fn add_panel<T: Panel>(&mut self, panel: View<T>, cx: &mut ViewContext<Self>) {
|
||||||
// if let Some(panel_ix) = self
|
let subscriptions = [
|
||||||
// .panel_entries
|
cx.observe(&panel, |_, _, cx| cx.notify()),
|
||||||
// .iter()
|
cx.subscribe(&panel, |this, panel, event, cx| {
|
||||||
// .position(|entry| entry.panel.id() == panel.id())
|
if T::should_activate_on_event(event) {
|
||||||
// {
|
if let Some(ix) = this
|
||||||
// if panel_ix == self.active_panel_index {
|
.panel_entries
|
||||||
// self.active_panel_index = 0;
|
.iter()
|
||||||
// self.set_open(false, cx);
|
.position(|entry| entry.panel.id() == panel.id())
|
||||||
// } else if panel_ix < self.active_panel_index {
|
{
|
||||||
// self.active_panel_index -= 1;
|
this.set_open(true, cx);
|
||||||
// }
|
this.activate_panel(ix, cx);
|
||||||
// self.panel_entries.remove(panel_ix);
|
// todo!()
|
||||||
// cx.notify();
|
// cx.focus(&panel);
|
||||||
// }
|
}
|
||||||
// }
|
} else if T::should_close_on_event(event)
|
||||||
|
&& this.visible_panel().map_or(false, |p| p.id() == panel.id())
|
||||||
|
{
|
||||||
|
this.set_open(false, cx);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
// pub fn panels_len(&self) -> usize {
|
// todo!()
|
||||||
// self.panel_entries.len()
|
// let dock_view_id = cx.view_id();
|
||||||
// }
|
self.panel_entries.push(PanelEntry {
|
||||||
|
panel: Arc::new(panel),
|
||||||
|
// todo!()
|
||||||
|
// context_menu: cx.add_view(|cx| {
|
||||||
|
// let mut menu = ContextMenu::new(dock_view_id, cx);
|
||||||
|
// menu.set_position_mode(OverlayPositionMode::Local);
|
||||||
|
// menu
|
||||||
|
// }),
|
||||||
|
_subscriptions: subscriptions,
|
||||||
|
});
|
||||||
|
cx.notify()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn remove_panel<T: Panel>(&mut self, panel: &View<T>, cx: &mut ViewContext<Self>) {
|
||||||
|
if let Some(panel_ix) = self
|
||||||
|
.panel_entries
|
||||||
|
.iter()
|
||||||
|
.position(|entry| entry.panel.id() == panel.id())
|
||||||
|
{
|
||||||
|
if panel_ix == self.active_panel_index {
|
||||||
|
self.active_panel_index = 0;
|
||||||
|
self.set_open(false, cx);
|
||||||
|
} else if panel_ix < self.active_panel_index {
|
||||||
|
self.active_panel_index -= 1;
|
||||||
|
}
|
||||||
|
self.panel_entries.remove(panel_ix);
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn panels_len(&self) -> usize {
|
||||||
|
self.panel_entries.len()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn activate_panel(&mut self, panel_ix: usize, cx: &mut ViewContext<Self>) {
|
pub fn activate_panel(&mut self, panel_ix: usize, cx: &mut ViewContext<Self>) {
|
||||||
if panel_ix != self.active_panel_index {
|
if panel_ix != self.active_panel_index {
|
||||||
|
@ -352,38 +355,38 @@ impl Dock {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn zoomed_panel(&self, cx: &WindowContext) -> Option<Arc<dyn PanelHandle>> {
|
pub fn zoomed_panel(&self, cx: &WindowContext) -> Option<Arc<dyn PanelHandle>> {
|
||||||
// let entry = self.visible_entry()?;
|
let entry = self.visible_entry()?;
|
||||||
// if entry.panel.is_zoomed(cx) {
|
if entry.panel.is_zoomed(cx) {
|
||||||
// Some(entry.panel.clone())
|
Some(entry.panel.clone())
|
||||||
// } else {
|
} else {
|
||||||
// None
|
None
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn panel_size(&self, panel: &dyn PanelHandle, cx: &WindowContext) -> Option<f32> {
|
pub fn panel_size(&self, panel: &dyn PanelHandle, cx: &WindowContext) -> Option<f32> {
|
||||||
// self.panel_entries
|
self.panel_entries
|
||||||
// .iter()
|
.iter()
|
||||||
// .find(|entry| entry.panel.id() == panel.id())
|
.find(|entry| entry.panel.id() == panel.id())
|
||||||
// .map(|entry| entry.panel.size(cx))
|
.map(|entry| entry.panel.size(cx))
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn active_panel_size(&self, cx: &WindowContext) -> Option<f32> {
|
pub fn active_panel_size(&self, cx: &WindowContext) -> Option<f32> {
|
||||||
// if self.is_open {
|
if self.is_open {
|
||||||
// self.panel_entries
|
self.panel_entries
|
||||||
// .get(self.active_panel_index)
|
.get(self.active_panel_index)
|
||||||
// .map(|entry| entry.panel.size(cx))
|
.map(|entry| entry.panel.size(cx))
|
||||||
// } else {
|
} else {
|
||||||
// None
|
None
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn resize_active_panel(&mut self, size: Option<f32>, cx: &mut ViewContext<Self>) {
|
pub fn resize_active_panel(&mut self, size: Option<f32>, cx: &mut ViewContext<Self>) {
|
||||||
// if let Some(entry) = self.panel_entries.get_mut(self.active_panel_index) {
|
if let Some(entry) = self.panel_entries.get_mut(self.active_panel_index) {
|
||||||
// entry.panel.set_size(size, cx);
|
entry.panel.set_size(size, cx);
|
||||||
// cx.notify();
|
cx.notify();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn render_placeholder(&self, cx: &WindowContext) -> AnyElement<Workspace> {
|
// pub fn render_placeholder(&self, cx: &WindowContext) -> AnyElement<Workspace> {
|
||||||
// todo!()
|
// todo!()
|
||||||
|
|
|
@ -220,36 +220,36 @@ pub mod simple_message_notification {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_element(
|
||||||
|
message: fn(TextStyle, &AppContext) -> AnyElement<MessageNotification>,
|
||||||
|
) -> MessageNotification {
|
||||||
|
Self {
|
||||||
|
message: NotificationMessage::Element(message),
|
||||||
|
on_click: None,
|
||||||
|
click_message: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_click_message<S>(mut self, message: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<Cow<'static, str>>,
|
||||||
|
{
|
||||||
|
self.click_message = Some(message.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn on_click<F>(mut self, on_click: F) -> Self
|
||||||
|
where
|
||||||
|
F: 'static + Send + Sync + Fn(&mut ViewContext<Self>),
|
||||||
|
{
|
||||||
|
self.on_click = Some(Arc::new(on_click));
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
// todo!()
|
// todo!()
|
||||||
// pub fn new_element(
|
// pub fn dismiss(&mut self, _: &CancelMessageNotification, cx: &mut ViewContext<Self>) {
|
||||||
// message: fn(TextStyle, &AppContext) -> AnyElement<MessageNotification>,
|
// cx.emit(MessageNotificationEvent::Dismiss);
|
||||||
// ) -> MessageNotification {
|
// }
|
||||||
// Self {
|
|
||||||
// message: NotificationMessage::Element(message),
|
|
||||||
// on_click: None,
|
|
||||||
// click_message: None,
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn with_click_message<S>(mut self, message: S) -> Self
|
|
||||||
// where
|
|
||||||
// S: Into<Cow<'static, str>>,
|
|
||||||
// {
|
|
||||||
// self.click_message = Some(message.into());
|
|
||||||
// self
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn on_click<F>(mut self, on_click: F) -> Self
|
|
||||||
// where
|
|
||||||
// F: 'static + Fn(&mut ViewContext<Self>),
|
|
||||||
// {
|
|
||||||
// self.on_click = Some(Arc::new(on_click));
|
|
||||||
// self
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn dismiss(&mut self, _: &CancelMessageNotification, cx: &mut ViewContext<Self>) {
|
|
||||||
// cx.emit(MessageNotificationEvent::Dismiss);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Render for MessageNotification {
|
impl Render for MessageNotification {
|
||||||
|
|
|
@ -416,17 +416,17 @@ impl Pane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub(crate) fn workspace(&self) -> &WeakView<Workspace> {
|
pub(crate) fn workspace(&self) -> &WeakView<Workspace> {
|
||||||
// &self.workspace
|
&self.workspace
|
||||||
// }
|
}
|
||||||
|
|
||||||
pub fn has_focus(&self) -> bool {
|
pub fn has_focus(&self) -> bool {
|
||||||
self.has_focus
|
self.has_focus
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn active_item_index(&self) -> usize {
|
pub fn active_item_index(&self) -> usize {
|
||||||
// self.active_item_index
|
self.active_item_index
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn on_can_drop<F>(&mut self, can_drop: F)
|
// pub fn on_can_drop<F>(&mut self, can_drop: F)
|
||||||
// where
|
// where
|
||||||
|
@ -1865,14 +1865,14 @@ impl Pane {
|
||||||
// .into_any()
|
// .into_any()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// pub fn set_zoomed(&mut self, zoomed: bool, cx: &mut ViewContext<Self>) {
|
pub fn set_zoomed(&mut self, zoomed: bool, cx: &mut ViewContext<Self>) {
|
||||||
// self.zoomed = zoomed;
|
self.zoomed = zoomed;
|
||||||
// cx.notify();
|
cx.notify();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn is_zoomed(&self) -> bool {
|
pub fn is_zoomed(&self) -> bool {
|
||||||
// self.zoomed
|
self.zoomed
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl Entity for Pane {
|
// impl Entity for Pane {
|
||||||
|
|
|
@ -8,6 +8,7 @@ pub mod pane;
|
||||||
pub mod pane_group;
|
pub mod pane_group;
|
||||||
mod persistence;
|
mod persistence;
|
||||||
pub mod searchable;
|
pub mod searchable;
|
||||||
|
// todo!()
|
||||||
// pub mod shared_screen;
|
// pub mod shared_screen;
|
||||||
mod status_bar;
|
mod status_bar;
|
||||||
mod toolbar;
|
mod toolbar;
|
||||||
|
@ -23,7 +24,7 @@ use client2::{
|
||||||
proto::{self, PeerId},
|
proto::{self, PeerId},
|
||||||
Client, TypedEnvelope, UserStore,
|
Client, TypedEnvelope, UserStore,
|
||||||
};
|
};
|
||||||
use collections::{HashMap, HashSet};
|
use collections::{hash_map, HashMap, HashSet};
|
||||||
use dock::{Dock, DockPosition, PanelButtons};
|
use dock::{Dock, DockPosition, PanelButtons};
|
||||||
use futures::{
|
use futures::{
|
||||||
channel::{mpsc, oneshot},
|
channel::{mpsc, oneshot},
|
||||||
|
@ -38,6 +39,7 @@ use gpui::{
|
||||||
WindowOptions,
|
WindowOptions,
|
||||||
};
|
};
|
||||||
use item::{FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, ProjectItem};
|
use item::{FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, ProjectItem};
|
||||||
|
use itertools::Itertools;
|
||||||
use language2::LanguageRegistry;
|
use language2::LanguageRegistry;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use node_runtime::NodeRuntime;
|
use node_runtime::NodeRuntime;
|
||||||
|
@ -174,42 +176,42 @@ pub struct Toast {
|
||||||
on_click: Option<(Cow<'static, str>, Arc<dyn Fn(&mut WindowContext)>)>,
|
on_click: Option<(Cow<'static, str>, Arc<dyn Fn(&mut WindowContext)>)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl Toast {
|
impl Toast {
|
||||||
// pub fn new<I: Into<Cow<'static, str>>>(id: usize, msg: I) -> Self {
|
pub fn new<I: Into<Cow<'static, str>>>(id: usize, msg: I) -> Self {
|
||||||
// Toast {
|
Toast {
|
||||||
// id,
|
id,
|
||||||
// msg: msg.into(),
|
msg: msg.into(),
|
||||||
// on_click: None,
|
on_click: None,
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn on_click<F, M>(mut self, message: M, on_click: F) -> Self
|
pub fn on_click<F, M>(mut self, message: M, on_click: F) -> Self
|
||||||
// where
|
where
|
||||||
// M: Into<Cow<'static, str>>,
|
M: Into<Cow<'static, str>>,
|
||||||
// F: Fn(&mut WindowContext) + 'static,
|
F: Fn(&mut WindowContext) + 'static,
|
||||||
// {
|
{
|
||||||
// self.on_click = Some((message.into(), Arc::new(on_click)));
|
self.on_click = Some((message.into(), Arc::new(on_click)));
|
||||||
// self
|
self
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// impl PartialEq for Toast {
|
impl PartialEq for Toast {
|
||||||
// fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
// self.id == other.id
|
self.id == other.id
|
||||||
// && self.msg == other.msg
|
&& self.msg == other.msg
|
||||||
// && self.on_click.is_some() == other.on_click.is_some()
|
&& self.on_click.is_some() == other.on_click.is_some()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// impl Clone for Toast {
|
impl Clone for Toast {
|
||||||
// fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
// Toast {
|
Toast {
|
||||||
// id: self.id,
|
id: self.id,
|
||||||
// msg: self.msg.to_owned(),
|
msg: self.msg.to_owned(),
|
||||||
// on_click: self.on_click.clone(),
|
on_click: self.on_click.clone(),
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[derive(Clone, Deserialize, PartialEq)]
|
// #[derive(Clone, Deserialize, PartialEq)]
|
||||||
// pub struct OpenTerminal {
|
// pub struct OpenTerminal {
|
||||||
|
@ -476,8 +478,7 @@ impl AppState {
|
||||||
let user_store = cx.build_model(|cx| UserStore::new(client.clone(), http_client, cx));
|
let user_store = cx.build_model(|cx| UserStore::new(client.clone(), http_client, cx));
|
||||||
let workspace_store = cx.build_model(|cx| WorkspaceStore::new(client.clone(), cx));
|
let workspace_store = cx.build_model(|cx| WorkspaceStore::new(client.clone(), cx));
|
||||||
|
|
||||||
// todo!()
|
theme2::init(cx);
|
||||||
// theme::init((), cx);
|
|
||||||
client2::init(&client, cx);
|
client2::init(&client, cx);
|
||||||
crate::init_settings(cx);
|
crate::init_settings(cx);
|
||||||
|
|
||||||
|
@ -549,7 +550,7 @@ pub struct Workspace {
|
||||||
weak_self: WeakView<Self>,
|
weak_self: WeakView<Self>,
|
||||||
// modal: Option<ActiveModal>,
|
// modal: Option<ActiveModal>,
|
||||||
zoomed: Option<AnyWeakView>,
|
zoomed: Option<AnyWeakView>,
|
||||||
// zoomed_position: Option<DockPosition>,
|
zoomed_position: Option<DockPosition>,
|
||||||
center: PaneGroup,
|
center: PaneGroup,
|
||||||
left_dock: View<Dock>,
|
left_dock: View<Dock>,
|
||||||
bottom_dock: View<Dock>,
|
bottom_dock: View<Dock>,
|
||||||
|
@ -626,7 +627,7 @@ impl Workspace {
|
||||||
}
|
}
|
||||||
|
|
||||||
project2::Event::Closed => {
|
project2::Event::Closed => {
|
||||||
// cx.remove_window();
|
cx.remove_window();
|
||||||
}
|
}
|
||||||
|
|
||||||
project2::Event::DeletedEntry(entry_id) => {
|
project2::Event::DeletedEntry(entry_id) => {
|
||||||
|
@ -768,7 +769,7 @@ impl Workspace {
|
||||||
weak_self: weak_handle.clone(),
|
weak_self: weak_handle.clone(),
|
||||||
// modal: None,
|
// modal: None,
|
||||||
zoomed: None,
|
zoomed: None,
|
||||||
// zoomed_position: None,
|
zoomed_position: None,
|
||||||
center: PaneGroup::new(center_pane.clone()),
|
center: PaneGroup::new(center_pane.clone()),
|
||||||
panes: vec![center_pane.clone()],
|
panes: vec![center_pane.clone()],
|
||||||
panes_by_item: Default::default(),
|
panes_by_item: Default::default(),
|
||||||
|
@ -1059,183 +1060,185 @@ impl Workspace {
|
||||||
&self.project
|
&self.project
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn recent_navigation_history(
|
pub fn recent_navigation_history(
|
||||||
// &self,
|
&self,
|
||||||
// limit: Option<usize>,
|
limit: Option<usize>,
|
||||||
// cx: &AppContext,
|
cx: &AppContext,
|
||||||
// ) -> Vec<(ProjectPath, Option<PathBuf>)> {
|
) -> Vec<(ProjectPath, Option<PathBuf>)> {
|
||||||
// let mut abs_paths_opened: HashMap<PathBuf, HashSet<ProjectPath>> = HashMap::default();
|
let mut abs_paths_opened: HashMap<PathBuf, HashSet<ProjectPath>> = HashMap::default();
|
||||||
// let mut history: HashMap<ProjectPath, (Option<PathBuf>, usize)> = HashMap::default();
|
let mut history: HashMap<ProjectPath, (Option<PathBuf>, usize)> = HashMap::default();
|
||||||
// for pane in &self.panes {
|
for pane in &self.panes {
|
||||||
// let pane = pane.read(cx);
|
let pane = pane.read(cx);
|
||||||
// pane.nav_history()
|
pane.nav_history()
|
||||||
// .for_each_entry(cx, |entry, (project_path, fs_path)| {
|
.for_each_entry(cx, |entry, (project_path, fs_path)| {
|
||||||
// if let Some(fs_path) = &fs_path {
|
if let Some(fs_path) = &fs_path {
|
||||||
// abs_paths_opened
|
abs_paths_opened
|
||||||
// .entry(fs_path.clone())
|
.entry(fs_path.clone())
|
||||||
// .or_default()
|
.or_default()
|
||||||
// .insert(project_path.clone());
|
.insert(project_path.clone());
|
||||||
// }
|
}
|
||||||
// let timestamp = entry.timestamp;
|
let timestamp = entry.timestamp;
|
||||||
// match history.entry(project_path) {
|
match history.entry(project_path) {
|
||||||
// hash_map::Entry::Occupied(mut entry) => {
|
hash_map::Entry::Occupied(mut entry) => {
|
||||||
// let (_, old_timestamp) = entry.get();
|
let (_, old_timestamp) = entry.get();
|
||||||
// if ×tamp > old_timestamp {
|
if ×tamp > old_timestamp {
|
||||||
// entry.insert((fs_path, timestamp));
|
entry.insert((fs_path, timestamp));
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// hash_map::Entry::Vacant(entry) => {
|
hash_map::Entry::Vacant(entry) => {
|
||||||
// entry.insert((fs_path, timestamp));
|
entry.insert((fs_path, timestamp));
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
// history
|
history
|
||||||
// .into_iter()
|
.into_iter()
|
||||||
// .sorted_by_key(|(_, (_, timestamp))| *timestamp)
|
.sorted_by_key(|(_, (_, timestamp))| *timestamp)
|
||||||
// .map(|(project_path, (fs_path, _))| (project_path, fs_path))
|
.map(|(project_path, (fs_path, _))| (project_path, fs_path))
|
||||||
// .rev()
|
.rev()
|
||||||
// .filter(|(history_path, abs_path)| {
|
.filter(|(history_path, abs_path)| {
|
||||||
// let latest_project_path_opened = abs_path
|
let latest_project_path_opened = abs_path
|
||||||
// .as_ref()
|
.as_ref()
|
||||||
// .and_then(|abs_path| abs_paths_opened.get(abs_path))
|
.and_then(|abs_path| abs_paths_opened.get(abs_path))
|
||||||
// .and_then(|project_paths| {
|
.and_then(|project_paths| {
|
||||||
// project_paths
|
project_paths
|
||||||
// .iter()
|
.iter()
|
||||||
// .max_by(|b1, b2| b1.worktree_id.cmp(&b2.worktree_id))
|
.max_by(|b1, b2| b1.worktree_id.cmp(&b2.worktree_id))
|
||||||
// });
|
});
|
||||||
|
|
||||||
// match latest_project_path_opened {
|
match latest_project_path_opened {
|
||||||
// Some(latest_project_path_opened) => latest_project_path_opened == history_path,
|
Some(latest_project_path_opened) => latest_project_path_opened == history_path,
|
||||||
// None => true,
|
None => true,
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// .take(limit.unwrap_or(usize::MAX))
|
.take(limit.unwrap_or(usize::MAX))
|
||||||
// .collect()
|
.collect()
|
||||||
// }
|
}
|
||||||
|
|
||||||
// fn navigate_history(
|
fn navigate_history(
|
||||||
// &mut self,
|
&mut self,
|
||||||
// pane: WeakView<Pane>,
|
pane: WeakView<Pane>,
|
||||||
// mode: NavigationMode,
|
mode: NavigationMode,
|
||||||
// cx: &mut ViewContext<Workspace>,
|
cx: &mut ViewContext<Workspace>,
|
||||||
// ) -> Task<Result<()>> {
|
) -> Task<Result<()>> {
|
||||||
// let to_load = if let Some(pane) = pane.upgrade(cx) {
|
let to_load = if let Some(pane) = pane.upgrade() {
|
||||||
// cx.focus(&pane);
|
// todo!("focus")
|
||||||
|
// cx.focus(&pane);
|
||||||
|
|
||||||
// pane.update(cx, |pane, cx| {
|
pane.update(cx, |pane, cx| {
|
||||||
// loop {
|
loop {
|
||||||
// // Retrieve the weak item handle from the history.
|
// Retrieve the weak item handle from the history.
|
||||||
// let entry = pane.nav_history_mut().pop(mode, cx)?;
|
let entry = pane.nav_history_mut().pop(mode, cx)?;
|
||||||
|
|
||||||
// // If the item is still present in this pane, then activate it.
|
// If the item is still present in this pane, then activate it.
|
||||||
// if let Some(index) = entry
|
if let Some(index) = entry
|
||||||
// .item
|
.item
|
||||||
// .upgrade(cx)
|
.upgrade()
|
||||||
// .and_then(|v| pane.index_for_item(v.as_ref()))
|
.and_then(|v| pane.index_for_item(v.as_ref()))
|
||||||
// {
|
{
|
||||||
// let prev_active_item_index = pane.active_item_index();
|
let prev_active_item_index = pane.active_item_index();
|
||||||
// pane.nav_history_mut().set_mode(mode);
|
pane.nav_history_mut().set_mode(mode);
|
||||||
// pane.activate_item(index, true, true, cx);
|
pane.activate_item(index, true, true, cx);
|
||||||
// pane.nav_history_mut().set_mode(NavigationMode::Normal);
|
pane.nav_history_mut().set_mode(NavigationMode::Normal);
|
||||||
|
|
||||||
// let mut navigated = prev_active_item_index != pane.active_item_index();
|
let mut navigated = prev_active_item_index != pane.active_item_index();
|
||||||
// if let Some(data) = entry.data {
|
if let Some(data) = entry.data {
|
||||||
// navigated |= pane.active_item()?.navigate(data, cx);
|
navigated |= pane.active_item()?.navigate(data, cx);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if navigated {
|
if navigated {
|
||||||
// break None;
|
break None;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// // If the item is no longer present in this pane, then retrieve its
|
// If the item is no longer present in this pane, then retrieve its
|
||||||
// // project path in order to reopen it.
|
// project path in order to reopen it.
|
||||||
// else {
|
else {
|
||||||
// break pane
|
break pane
|
||||||
// .nav_history()
|
.nav_history()
|
||||||
// .path_for_item(entry.item.id())
|
.path_for_item(entry.item.id())
|
||||||
// .map(|(project_path, _)| (project_path, entry));
|
.map(|(project_path, _)| (project_path, entry));
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// } else {
|
} else {
|
||||||
// None
|
None
|
||||||
// };
|
};
|
||||||
|
|
||||||
// if let Some((project_path, entry)) = to_load {
|
if let Some((project_path, entry)) = to_load {
|
||||||
// // If the item was no longer present, then load it again from its previous path.
|
// If the item was no longer present, then load it again from its previous path.
|
||||||
// let task = self.load_path(project_path, cx);
|
let task = self.load_path(project_path, cx);
|
||||||
// cx.spawn(|workspace, mut cx| async move {
|
cx.spawn(|workspace, mut cx| async move {
|
||||||
// let task = task.await;
|
let task = task.await;
|
||||||
// let mut navigated = false;
|
let mut navigated = false;
|
||||||
// if let Some((project_entry_id, build_item)) = task.log_err() {
|
if let Some((project_entry_id, build_item)) = task.log_err() {
|
||||||
// let prev_active_item_id = pane.update(&mut cx, |pane, _| {
|
let prev_active_item_id = pane.update(&mut cx, |pane, _| {
|
||||||
// pane.nav_history_mut().set_mode(mode);
|
pane.nav_history_mut().set_mode(mode);
|
||||||
// pane.active_item().map(|p| p.id())
|
pane.active_item().map(|p| p.id())
|
||||||
// })?;
|
})?;
|
||||||
|
|
||||||
// pane.update(&mut cx, |pane, cx| {
|
pane.update(&mut cx, |pane, cx| {
|
||||||
// let item = pane.open_item(project_entry_id, true, cx, build_item);
|
let item = pane.open_item(project_entry_id, true, cx, build_item);
|
||||||
// navigated |= Some(item.id()) != prev_active_item_id;
|
navigated |= Some(item.id()) != prev_active_item_id;
|
||||||
// pane.nav_history_mut().set_mode(NavigationMode::Normal);
|
pane.nav_history_mut().set_mode(NavigationMode::Normal);
|
||||||
// if let Some(data) = entry.data {
|
if let Some(data) = entry.data {
|
||||||
// navigated |= item.navigate(data, cx);
|
navigated |= item.navigate(data, cx);
|
||||||
// }
|
}
|
||||||
// })?;
|
})?;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if !navigated {
|
if !navigated {
|
||||||
// workspace
|
workspace
|
||||||
// .update(&mut cx, |workspace, cx| {
|
.update(&mut cx, |workspace, cx| {
|
||||||
// Self::navigate_history(workspace, pane, mode, cx)
|
Self::navigate_history(workspace, pane, mode, cx)
|
||||||
// })?
|
})?
|
||||||
// .await?;
|
.await?;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Ok(())
|
Ok(())
|
||||||
// })
|
})
|
||||||
// } else {
|
} else {
|
||||||
// Task::ready(Ok(()))
|
Task::ready(Ok(()))
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn go_back(
|
pub fn go_back(
|
||||||
// &mut self,
|
&mut self,
|
||||||
// pane: WeakView<Pane>,
|
pane: WeakView<Pane>,
|
||||||
// cx: &mut ViewContext<Workspace>,
|
cx: &mut ViewContext<Workspace>,
|
||||||
// ) -> Task<Result<()>> {
|
) -> Task<Result<()>> {
|
||||||
// self.navigate_history(pane, NavigationMode::GoingBack, cx)
|
self.navigate_history(pane, NavigationMode::GoingBack, cx)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn go_forward(
|
pub fn go_forward(
|
||||||
// &mut self,
|
&mut self,
|
||||||
// pane: WeakView<Pane>,
|
pane: WeakView<Pane>,
|
||||||
// cx: &mut ViewContext<Workspace>,
|
cx: &mut ViewContext<Workspace>,
|
||||||
// ) -> Task<Result<()>> {
|
) -> Task<Result<()>> {
|
||||||
// self.navigate_history(pane, NavigationMode::GoingForward, cx)
|
self.navigate_history(pane, NavigationMode::GoingForward, cx)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn reopen_closed_item(&mut self, cx: &mut ViewContext<Workspace>) -> Task<Result<()>> {
|
pub fn reopen_closed_item(&mut self, cx: &mut ViewContext<Workspace>) -> Task<Result<()>> {
|
||||||
// self.navigate_history(
|
self.navigate_history(
|
||||||
// self.active_pane().downgrade(),
|
self.active_pane().downgrade(),
|
||||||
// NavigationMode::ReopeningClosedItem,
|
NavigationMode::ReopeningClosedItem,
|
||||||
// cx,
|
cx,
|
||||||
// )
|
)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn client(&self) -> &Client {
|
pub fn client(&self) -> &Client {
|
||||||
// &self.app_state.client
|
&self.app_state.client
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn set_titlebar_item(&mut self, item: AnyViewHandle, cx: &mut ViewContext<Self>) {
|
// todo!()
|
||||||
// self.titlebar_item = Some(item);
|
// pub fn set_titlebar_item(&mut self, item: AnyViewHandle, cx: &mut ViewContext<Self>) {
|
||||||
// cx.notify();
|
// self.titlebar_item = Some(item);
|
||||||
// }
|
// cx.notify();
|
||||||
|
// }
|
||||||
|
|
||||||
// pub fn titlebar_item(&self) -> Option<AnyViewHandle> {
|
// pub fn titlebar_item(&self) -> Option<AnyViewHandle> {
|
||||||
// self.titlebar_item.clone()
|
// self.titlebar_item.clone()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// /// Call the given callback with a workspace whose project is local.
|
// /// Call the given callback with a workspace whose project is local.
|
||||||
// ///
|
// ///
|
||||||
|
@ -1261,32 +1264,29 @@ impl Workspace {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// pub fn worktrees<'a>(
|
pub fn worktrees<'a>(&self, cx: &'a AppContext) -> impl 'a + Iterator<Item = Model<Worktree>> {
|
||||||
// &self,
|
self.project.read(cx).worktrees()
|
||||||
// cx: &'a AppContext,
|
}
|
||||||
// ) -> impl 'a + Iterator<Item = ModelHandle<Worktree>> {
|
|
||||||
// self.project.read(cx).worktrees(cx)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn visible_worktrees<'a>(
|
pub fn visible_worktrees<'a>(
|
||||||
// &self,
|
&self,
|
||||||
// cx: &'a AppContext,
|
cx: &'a AppContext,
|
||||||
// ) -> impl 'a + Iterator<Item = ModelHandle<Worktree>> {
|
) -> impl 'a + Iterator<Item = Model<Worktree>> {
|
||||||
// self.project.read(cx).visible_worktrees(cx)
|
self.project.read(cx).visible_worktrees(cx)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn worktree_scans_complete(&self, cx: &AppContext) -> impl Future<Output = ()> + 'static {
|
pub fn worktree_scans_complete(&self, cx: &AppContext) -> impl Future<Output = ()> + 'static {
|
||||||
// let futures = self
|
let futures = self
|
||||||
// .worktrees(cx)
|
.worktrees(cx)
|
||||||
// .filter_map(|worktree| worktree.read(cx).as_local())
|
.filter_map(|worktree| worktree.read(cx).as_local())
|
||||||
// .map(|worktree| worktree.scan_complete())
|
.map(|worktree| worktree.scan_complete())
|
||||||
// .collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
// async move {
|
async move {
|
||||||
// for future in futures {
|
for future in futures {
|
||||||
// future.await;
|
future.await;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn close_global(_: &CloseWindow, cx: &mut AppContext) {
|
// pub fn close_global(_: &CloseWindow, cx: &mut AppContext) {
|
||||||
// cx.spawn(|mut cx| async move {
|
// cx.spawn(|mut cx| async move {
|
||||||
|
@ -1699,31 +1699,31 @@ impl Workspace {
|
||||||
self.active_pane().read(cx).active_item()
|
self.active_pane().read(cx).active_item()
|
||||||
}
|
}
|
||||||
|
|
||||||
// fn active_project_path(&self, cx: &ViewContext<Self>) -> Option<ProjectPath> {
|
fn active_project_path(&self, cx: &ViewContext<Self>) -> Option<ProjectPath> {
|
||||||
// self.active_item(cx).and_then(|item| item.project_path(cx))
|
self.active_item(cx).and_then(|item| item.project_path(cx))
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn save_active_item(
|
pub fn save_active_item(
|
||||||
// &mut self,
|
&mut self,
|
||||||
// save_intent: SaveIntent,
|
save_intent: SaveIntent,
|
||||||
// cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
// ) -> Task<Result<()>> {
|
) -> Task<Result<()>> {
|
||||||
// let project = self.project.clone();
|
let project = self.project.clone();
|
||||||
// let pane = self.active_pane();
|
let pane = self.active_pane();
|
||||||
// let item_ix = pane.read(cx).active_item_index();
|
let item_ix = pane.read(cx).active_item_index();
|
||||||
// let item = pane.read(cx).active_item();
|
let item = pane.read(cx).active_item();
|
||||||
// let pane = pane.downgrade();
|
let pane = pane.downgrade();
|
||||||
|
|
||||||
// cx.spawn(|_, mut cx| async move {
|
cx.spawn(|_, mut cx| async move {
|
||||||
// if let Some(item) = item {
|
if let Some(item) = item {
|
||||||
// Pane::save_item(project, &pane, item_ix, item.as_ref(), save_intent, &mut cx)
|
Pane::save_item(project, &pane, item_ix, item.as_ref(), save_intent, &mut cx)
|
||||||
// .await
|
.await
|
||||||
// .map(|_| ())
|
.map(|_| ())
|
||||||
// } else {
|
} else {
|
||||||
// Ok(())
|
Ok(())
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn close_inactive_items_and_panes(
|
// pub fn close_inactive_items_and_panes(
|
||||||
// &mut self,
|
// &mut self,
|
||||||
|
@ -1825,19 +1825,20 @@ impl Workspace {
|
||||||
// self.serialize_workspace(cx);
|
// self.serialize_workspace(cx);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// pub fn close_all_docks(&mut self, cx: &mut ViewContext<Self>) {
|
pub fn close_all_docks(&mut self, cx: &mut ViewContext<Self>) {
|
||||||
// let docks = [&self.left_dock, &self.bottom_dock, &self.right_dock];
|
let docks = [&self.left_dock, &self.bottom_dock, &self.right_dock];
|
||||||
|
|
||||||
// for dock in docks {
|
for dock in docks {
|
||||||
// dock.update(cx, |dock, cx| {
|
dock.update(cx, |dock, cx| {
|
||||||
// dock.set_open(false, cx);
|
dock.set_open(false, cx);
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
// cx.focus_self();
|
// todo!("focus")
|
||||||
// cx.notify();
|
// cx.focus_self();
|
||||||
// self.serialize_workspace(cx);
|
cx.notify();
|
||||||
// }
|
self.serialize_workspace(cx);
|
||||||
|
}
|
||||||
|
|
||||||
// /// Transfer focus to the panel of the given type.
|
// /// Transfer focus to the panel of the given type.
|
||||||
// pub fn focus_panel<T: Panel>(&mut self, cx: &mut ViewContext<Self>) -> Option<View<T>> {
|
// pub fn focus_panel<T: Panel>(&mut self, cx: &mut ViewContext<Self>) -> Option<View<T>> {
|
||||||
|
@ -1904,19 +1905,19 @@ impl Workspace {
|
||||||
// None
|
// None
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// fn zoom_out(&mut self, cx: &mut ViewContext<Self>) {
|
fn zoom_out(&mut self, cx: &mut ViewContext<Self>) {
|
||||||
// for pane in &self.panes {
|
for pane in &self.panes {
|
||||||
// pane.update(cx, |pane, cx| pane.set_zoomed(false, cx));
|
pane.update(cx, |pane, cx| pane.set_zoomed(false, cx));
|
||||||
// }
|
}
|
||||||
|
|
||||||
// self.left_dock.update(cx, |dock, cx| dock.zoom_out(cx));
|
self.left_dock.update(cx, |dock, cx| dock.zoom_out(cx));
|
||||||
// self.bottom_dock.update(cx, |dock, cx| dock.zoom_out(cx));
|
self.bottom_dock.update(cx, |dock, cx| dock.zoom_out(cx));
|
||||||
// self.right_dock.update(cx, |dock, cx| dock.zoom_out(cx));
|
self.right_dock.update(cx, |dock, cx| dock.zoom_out(cx));
|
||||||
// self.zoomed = None;
|
self.zoomed = None;
|
||||||
// self.zoomed_position = None;
|
self.zoomed_position = None;
|
||||||
|
|
||||||
// cx.notify();
|
cx.notify();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[cfg(any(test, feature = "test-support"))]
|
// #[cfg(any(test, feature = "test-support"))]
|
||||||
// pub fn zoomed_view(&self, cx: &AppContext) -> Option<AnyViewHandle> {
|
// pub fn zoomed_view(&self, cx: &AppContext) -> Option<AnyViewHandle> {
|
||||||
|
@ -1962,22 +1963,21 @@ impl Workspace {
|
||||||
// cx.notify();
|
// cx.notify();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
fn add_pane(&mut self, _cx: &mut ViewContext<Self>) -> View<Pane> {
|
fn add_pane(&mut self, cx: &mut ViewContext<Self>) -> View<Pane> {
|
||||||
todo!()
|
let pane = cx.build_view(|cx| {
|
||||||
// let pane = cx.build_view(|cx| {
|
Pane::new(
|
||||||
// Pane::new(
|
self.weak_handle(),
|
||||||
// self.weak_handle(),
|
self.project.clone(),
|
||||||
// self.project.clone(),
|
self.pane_history_timestamp.clone(),
|
||||||
// self.pane_history_timestamp.clone(),
|
cx,
|
||||||
// cx,
|
)
|
||||||
// )
|
});
|
||||||
// });
|
cx.subscribe(&pane, Self::handle_pane_event).detach();
|
||||||
// cx.subscribe(&pane, Self::handle_pane_event).detach();
|
self.panes.push(pane.clone());
|
||||||
// self.panes.push(pane.clone());
|
|
||||||
// todo!()
|
// todo!()
|
||||||
// cx.focus(&pane);
|
// cx.focus(&pane);
|
||||||
// cx.emit(Event::PaneAdded(pane.clone()));
|
cx.emit(Event::PaneAdded(pane.clone()));
|
||||||
// pane
|
pane
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn add_item_to_center(
|
// pub fn add_item_to_center(
|
||||||
|
@ -3122,6 +3122,7 @@ impl Workspace {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo!()
|
||||||
// fn shared_screen_for_peer(
|
// fn shared_screen_for_peer(
|
||||||
// &self,
|
// &self,
|
||||||
// peer_id: PeerId,
|
// peer_id: PeerId,
|
||||||
|
@ -3498,6 +3499,7 @@ impl Workspace {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo!()
|
||||||
// #[cfg(any(test, feature = "test-support"))]
|
// #[cfg(any(test, feature = "test-support"))]
|
||||||
// pub fn test_new(project: ModelHandle<Project>, cx: &mut ViewContext<Self>) -> Self {
|
// pub fn test_new(project: ModelHandle<Project>, cx: &mut ViewContext<Self>) -> Self {
|
||||||
// use node_runtime::FakeNodeRuntime;
|
// use node_runtime::FakeNodeRuntime;
|
||||||
|
@ -3658,6 +3660,7 @@ fn open_items(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo!()
|
||||||
// fn notify_of_new_dock(workspace: &WeakView<Workspace>, cx: &mut AsyncAppContext) {
|
// fn notify_of_new_dock(workspace: &WeakView<Workspace>, cx: &mut AsyncAppContext) {
|
||||||
// const NEW_PANEL_BLOG_POST: &str = "https://zed.dev/blog/new-panel-system";
|
// const NEW_PANEL_BLOG_POST: &str = "https://zed.dev/blog/new-panel-system";
|
||||||
// const NEW_DOCK_HINT_KEY: &str = "show_new_dock_key";
|
// const NEW_DOCK_HINT_KEY: &str = "show_new_dock_key";
|
||||||
|
@ -3738,23 +3741,22 @@ fn open_items(
|
||||||
// })
|
// })
|
||||||
// .ok();
|
// .ok();
|
||||||
|
|
||||||
fn notify_if_database_failed(_workspace: WindowHandle<Workspace>, _cx: &mut AsyncAppContext) {
|
fn notify_if_database_failed(workspace: WindowHandle<Workspace>, cx: &mut AsyncAppContext) {
|
||||||
const REPORT_ISSUE_URL: &str ="https://github.com/zed-industries/community/issues/new?assignees=&labels=defect%2Ctriage&template=2_bug_report.yml";
|
const REPORT_ISSUE_URL: &str ="https://github.com/zed-industries/community/issues/new?assignees=&labels=defect%2Ctriage&template=2_bug_report.yml";
|
||||||
|
|
||||||
// todo!()
|
workspace
|
||||||
// workspace
|
.update(cx, |workspace, cx| {
|
||||||
// .update(cx, |workspace, cx| {
|
if (*db2::ALL_FILE_DB_FAILED).load(std::sync::atomic::Ordering::Acquire) {
|
||||||
// if (*db::ALL_FILE_DB_FAILED).load(std::sync::atomic::Ordering::Acquire) {
|
workspace.show_notification_once(0, cx, |cx| {
|
||||||
// workspace.show_notification_once(0, cx, |cx| {
|
cx.build_view(|_| {
|
||||||
// cx.build_view(|_| {
|
MessageNotification::new("Failed to load the database file.")
|
||||||
// MessageNotification::new("Failed to load the database file.")
|
.with_click_message("Click to let us know about this error")
|
||||||
// .with_click_message("Click to let us know about this error")
|
.on_click(|cx| cx.open_url(REPORT_ISSUE_URL))
|
||||||
// .on_click(|cx| cx.platform().open_url(REPORT_ISSUE_URL))
|
})
|
||||||
// })
|
});
|
||||||
// });
|
}
|
||||||
// }
|
})
|
||||||
// })
|
.log_err();
|
||||||
// .log_err();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventEmitter for Workspace {
|
impl EventEmitter for Workspace {
|
||||||
|
@ -4176,36 +4178,32 @@ impl WorkspaceStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_update_followers(
|
async fn handle_update_followers(
|
||||||
_this: Model<Self>,
|
this: Model<Self>,
|
||||||
_envelope: TypedEnvelope<proto::UpdateFollowers>,
|
envelope: TypedEnvelope<proto::UpdateFollowers>,
|
||||||
_: Arc<Client>,
|
_: Arc<Client>,
|
||||||
mut _cx: AsyncWindowContext,
|
mut cx: AsyncWindowContext,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
// let leader_id = envelope.original_sender_id()?;
|
let leader_id = envelope.original_sender_id()?;
|
||||||
// let update = envelope.payload;
|
let update = envelope.payload;
|
||||||
|
|
||||||
// this.update(&mut cx, |this, cx| {
|
this.update(&mut cx, |this, cx| {
|
||||||
// for workspace in &this.workspaces {
|
for workspace in &this.workspaces {
|
||||||
// let Some(workspace) = workspace.upgrade() else {
|
workspace.update(cx, |workspace, cx| {
|
||||||
// continue;
|
let project_id = workspace.project.read(cx).remote_id();
|
||||||
// };
|
if update.project_id != project_id && update.project_id.is_some() {
|
||||||
// workspace.update(cx, |workspace, cx| {
|
return;
|
||||||
// let project_id = workspace.project.read(cx).remote_id();
|
}
|
||||||
// if update.project_id != project_id && update.project_id.is_some() {
|
workspace.handle_update_followers(leader_id, update.clone(), cx);
|
||||||
// return;
|
})?;
|
||||||
// }
|
}
|
||||||
// workspace.handle_update_followers(leader_id, update.clone(), cx);
|
Ok(())
|
||||||
// });
|
})?
|
||||||
// }
|
|
||||||
// Ok(())
|
|
||||||
// })?
|
|
||||||
todo!()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl Entity for WorkspaceStore {
|
impl EventEmitter for WorkspaceStore {
|
||||||
// type Event = ();
|
type Event = ();
|
||||||
// }
|
}
|
||||||
|
|
||||||
impl ViewId {
|
impl ViewId {
|
||||||
pub(crate) fn from_proto(message: proto::ViewId) -> Result<Self> {
|
pub(crate) fn from_proto(message: proto::ViewId) -> Result<Self> {
|
||||||
|
|
|
@ -114,7 +114,7 @@ pub async fn handle_cli_connection(
|
||||||
match item {
|
match item {
|
||||||
Some(Ok(mut item)) => {
|
Some(Ok(mut item)) => {
|
||||||
if let Some(point) = caret_positions.remove(path) {
|
if let Some(point) = caret_positions.remove(path) {
|
||||||
todo!()
|
todo!("editor")
|
||||||
// if let Some(active_editor) = item.downcast::<Editor>() {
|
// if let Some(active_editor) = item.downcast::<Editor>() {
|
||||||
// active_editor
|
// active_editor
|
||||||
// .downgrade()
|
// .downgrade()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue