Remove or fix stale todos (#3990)

The software equivalent of dusting

Release Notes:

-
This commit is contained in:
Mikayla Maki 2024-01-09 18:37:35 -08:00 committed by GitHub
commit 45baad2825
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 186 additions and 360 deletions

View file

@ -167,15 +167,6 @@ impl DockPosition {
}
}
// todo!()
// fn to_resize_handle_side(self) -> HandleSide {
// match self {
// Self::Left => HandleSide::Right,
// Self::Bottom => HandleSide::Top,
// Self::Right => HandleSide::Left,
// }
// }
pub fn axis(&self) -> Axis {
match self {
Self::Left | Self::Right => Axis::Horizontal,
@ -186,8 +177,6 @@ impl DockPosition {
struct PanelEntry {
panel: Arc<dyn PanelHandle>,
// todo!()
// context_menu: View<ContextMenu>,
_subscriptions: [Subscription; 2],
}
@ -265,12 +254,6 @@ impl Dock {
self.is_open
}
// todo!()
// pub fn has_focus(&self, cx: &WindowContext) -> bool {
// self.visible_panel()
// .map_or(false, |panel| panel.has_focus(cx))
// }
pub fn panel<T: Panel>(&self) -> Option<View<T>> {
self.panel_entries
.iter()
@ -417,16 +400,8 @@ impl Dock {
}),
];
// todo!()
// 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()
@ -618,7 +593,6 @@ impl PanelButtons {
impl Render for PanelButtons {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
// todo!()
let dock = self.dock.read(cx);
let active_index = dock.active_panel_index;
let is_open = dock.is_open;

View file

@ -8,8 +8,6 @@ use std::{any::TypeId, ops::DerefMut};
pub fn init(cx: &mut AppContext) {
cx.set_global(NotificationTracker::new());
// todo!()
// simple_message_notification::init(cx);
}
pub trait Notification: EventEmitter<DismissEvent> + Render {}

View file

@ -242,87 +242,6 @@ pub struct DraggedTab {
pub is_active: bool,
}
// pub struct DraggedItem {
// pub handle: Box<dyn ItemHandle>,
// pub pane: WeakView<Pane>,
// }
// pub enum ReorderBehavior {
// None,
// MoveAfterActive,
// MoveToIndex(usize),
// }
// #[derive(Debug, Clone, Copy, PartialEq, Eq)]
// enum TabBarContextMenuKind {
// New,
// Split,
// }
// struct TabBarContextMenu {
// kind: TabBarContextMenuKind,
// handle: View<ContextMenu>,
// }
// impl TabBarContextMenu {
// fn handle_if_kind(&self, kind: TabBarContextMenuKind) -> Option<View<ContextMenu>> {
// if self.kind == kind {
// return Some(self.handle.clone());
// }
// None
// }
// }
// #[allow(clippy::too_many_arguments)]
// fn nav_button<A: Action, F: 'static + Fn(&mut Pane, &mut ViewContext<Pane>)>(
// svg_path: &'static str,
// style: theme::Interactive<theme2::IconButton>,
// nav_button_height: f32,
// tooltip_style: TooltipStyle,
// enabled: bool,
// on_click: F,
// tooltip_action: A,
// action_name: &str,
// cx: &mut ViewContext<Pane>,
// ) -> AnyElement<Pane> {
// MouseEventHandler::new::<A, _>(0, cx, |state, _| {
// let style = if enabled {
// style.style_for(state)
// } else {
// style.disabled_style()
// };
// Svg::new(svg_path)
// .with_color(style.color)
// .constrained()
// .with_width(style.icon_width)
// .aligned()
// .contained()
// .with_style(style.container)
// .constrained()
// .with_width(style.button_width)
// .with_height(nav_button_height)
// .aligned()
// .top()
// })
// .with_cursor_style(if enabled {
// CursorStyle::PointingHand
// } else {
// CursorStyle::default()
// })
// .on_click(MouseButton::Left, move |_, toolbar, cx| {
// on_click(toolbar, cx)
// })
// .with_tooltip::<A>(
// 0,
// action_name.to_string(),
// Some(Box::new(tooltip_action)),
// tooltip_style,
// cx,
// )
// .contained()
// .into_any_named("nav button")
// }
impl EventEmitter<Event> for Pane {}
impl Pane {
@ -333,13 +252,6 @@ impl Pane {
can_drop_predicate: Option<Arc<dyn Fn(&dyn Any, &mut WindowContext) -> bool + 'static>>,
cx: &mut ViewContext<Self>,
) -> Self {
// todo!("context menu")
// let pane_view_id = cx.view_id();
// let context_menu = cx.build_view(|cx| ContextMenu::new(pane_view_id, cx));
// context_menu.update(cx, |menu, _| {
// menu.set_position_mode(OverlayPositionMode::Local)
// });
//
let focus_handle = cx.focus_handle();
let subscriptions = vec![
@ -370,11 +282,6 @@ impl Pane {
split_item_menu: None,
tab_bar_scroll_handle: ScrollHandle::new(),
drag_split_direction: None,
// tab_bar_context_menu: TabBarContextMenu {
// kind: TabBarContextMenuKind::New,
// handle: context_menu,
// },
// tab_context_menu: cx.build_view(|_| ContextMenu::new(pane_view_id, cx)),
workspace,
project,
can_drop_predicate,
@ -450,7 +357,6 @@ impl Pane {
}
pub fn has_focus(&self, cx: &WindowContext) -> bool {
// todo!(); // inline this manually
self.focus_handle.contains_focused(cx)
}

View file

@ -12,7 +12,7 @@ use serde::Deserialize;
use std::sync::Arc;
use ui::{prelude::*, Button};
const HANDLE_HITBOX_SIZE: f32 = 4.0;
pub const HANDLE_HITBOX_SIZE: f32 = 4.0;
const HORIZONTAL_MIN_SIZE: f32 = 80.;
const VERTICAL_MIN_SIZE: f32 = 100.;
@ -268,15 +268,6 @@ impl Member {
)
})
.into_any()
// let el = div()
// .flex()
// .flex_1()
// .gap_px()
// .w_full()
// .h_full()
// .bg(cx.theme().colors().editor)
// .children();
}
Member::Axis(axis) => axis
.render(

View file

@ -1,8 +1,8 @@
use std::{any::Any, sync::Arc};
use gpui::{
AnyView, AppContext, EventEmitter, Subscription, Task, View, ViewContext, WeakView,
WindowContext,
AnyView, AnyWeakView, AppContext, EventEmitter, Subscription, Task, View, ViewContext,
WeakView, WindowContext,
};
use project::search::SearchQuery;
@ -127,7 +127,6 @@ pub trait SearchableItemHandle: ItemHandle {
) -> Option<usize>;
}
// todo!("here is where we need to use AnyWeakView");
impl<T: SearchableItem> SearchableItemHandle for View<T> {
fn downgrade(&self) -> Box<dyn WeakSearchableItemHandle> {
Box::new(self.downgrade())
@ -249,7 +248,7 @@ impl Eq for Box<dyn SearchableItemHandle> {}
pub trait WeakSearchableItemHandle: WeakItemHandle {
fn upgrade(&self, cx: &AppContext) -> Option<Box<dyn SearchableItemHandle>>;
// fn into_any(self) -> AnyWeakView;
fn into_any(self) -> AnyWeakView;
}
impl<T: SearchableItem> WeakSearchableItemHandle for WeakView<T> {
@ -257,9 +256,9 @@ impl<T: SearchableItem> WeakSearchableItemHandle for WeakView<T> {
Some(Box::new(self.upgrade()?))
}
// fn into_any(self) -> AnyView {
// self.into_any()
// }
fn into_any(self) -> AnyWeakView {
self.into()
}
}
impl PartialEq for Box<dyn WeakSearchableItemHandle> {

View file

@ -852,6 +852,10 @@ impl Workspace {
&self.right_dock
}
pub fn is_edited(&self) -> bool {
self.window_edited
}
pub fn add_panel<T: Panel>(&mut self, panel: View<T>, cx: &mut ViewContext<Self>) {
let dock = match panel.position(cx) {
DockPosition::Left => &self.left_dock,
@ -1143,7 +1147,6 @@ impl Workspace {
quitting: bool,
cx: &mut ViewContext<Self>,
) -> Task<Result<bool>> {
//todo!(saveing)
let active_call = self.active_call().cloned();
let window = cx.window_handle();
@ -1694,28 +1697,6 @@ impl Workspace {
None
}
// todo!("implement zoom")
#[allow(unused)]
fn zoom_out(&mut self, cx: &mut ViewContext<Self>) {
for pane in &self.panes {
pane.update(cx, |pane, cx| pane.set_zoomed(false, cx));
}
self.left_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.zoomed = None;
self.zoomed_position = None;
cx.notify();
}
// todo!()
// #[cfg(any(test, feature = "test-support"))]
// pub fn zoomed_view(&self, cx: &AppContext) -> Option<AnyViewHandle> {
// self.zoomed.and_then(|view| view.upgrade(cx))
// }
fn dismiss_zoomed_items_to_reveal(
&mut self,
dock_to_reveal: Option<DockPosition>,
@ -2078,7 +2059,7 @@ impl Workspace {
_ => bounding_box.center(),
};
let distance_to_next = 8.; //todo(pane dividers styling)
let distance_to_next = pane_group::HANDLE_HITBOX_SIZE;
let target = match direction {
SplitDirection::Left => {