Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix / remove small todos
Mikayla80790d921dcd
diff --git a/crates/collab/src/tests/channel_message_tests.rs b/crates/collab/src/tests/channel_message_tests.rsindex f5da0e3ee6f..5870bd19384 100644--- a/crates/collab/src/tests/channel_message_tests.rs+++ b/crates/collab/src/tests/channel_message_tests.rs@@ -262,7 +262,6 @@ async fn test_remove_channel_message(#[track_caller]fn assert_messages(chat: &Model<ChannelChat>, messages: &[&str], cx: &mut TestAppContext) {- // todo!(don't directly borrow here)assert_eq!(chat.read_with(cx, |chat, _| {chat.messages()diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rsindex f2106b9a8f4..03dfd450704 100644--- a/crates/collab_ui/src/collab_titlebar_item.rs+++ b/crates/collab_ui/src/collab_titlebar_item.rs@@ -41,12 +41,6 @@ pub fn init(cx: &mut AppContext) {workspace.set_titlebar_item(titlebar_item.into(), cx)}).detach();- // todo!()- // cx.add_action(CollabTitlebarItem::share_project);- // cx.add_action(CollabTitlebarItem::unshare_project);- // cx.add_action(CollabTitlebarItem::toggle_user_menu);- // cx.add_action(CollabTitlebarItem::toggle_vcs_menu);- // cx.add_action(CollabTitlebarItem::toggle_project_menu);}pub struct CollabTitlebarItem {diff --git a/crates/collab_ui/src/notifications/incoming_call_notification.rs b/crates/collab_ui/src/notifications/incoming_call_notification.rsindex 223415119fc..93df9a4be54 100644--- a/crates/collab_ui/src/notifications/incoming_call_notification.rs+++ b/crates/collab_ui/src/notifications/incoming_call_notification.rs@@ -19,7 +19,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {for window in notification_windows.drain(..) {window.update(&mut cx, |_, cx| {- // todo!()cx.remove_window();}).log_err();diff --git a/crates/collab_ui/src/notifications/project_shared_notification.rs b/crates/collab_ui/src/notifications/project_shared_notification.rsindex 79adc69a801..88fe540c397 100644--- a/crates/collab_ui/src/notifications/project_shared_notification.rs+++ b/crates/collab_ui/src/notifications/project_shared_notification.rs@@ -51,7 +51,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {for window in windows {window.update(cx, |_, cx| {- // todo!()cx.remove_window();}).ok();@@ -64,7 +63,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {for window in windows {window.update(cx, |_, cx| {- // todo!()cx.remove_window();}).ok();diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 71fe6ccfcbc..95aec1a2007 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -1829,10 +1829,6 @@ impl Editor {this.end_selection(cx);this.scroll_manager.show_scrollbar(cx);- // todo!("use a different mechanism")- // let editor_created_event = EditorCreated(cx.handle());- // cx.emit_global(editor_created_event);-if mode == EditorMode::Full {let should_auto_hide_scrollbars = cx.should_auto_hide_scrollbars();cx.set_global(ScrollbarAutoHide(should_auto_hide_scrollbars));diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rsindex 66f28db3e46..520c3714d3d 100644--- a/crates/editor/src/editor_tests.rs+++ b/crates/editor/src/editor_tests.rs@@ -539,7 +539,6 @@ fn test_clone(cx: &mut TestAppContext) {);}-//todo!(editor navigate)#[gpui::test]async fn test_navigation_history(cx: &mut TestAppContext) {init_test(cx, |_| {});@@ -993,7 +992,6 @@ fn test_move_cursor_multibyte(cx: &mut TestAppContext) {});}-//todo!(finish editor tests)#[gpui::test]fn test_move_cursor_different_line_lengths(cx: &mut TestAppContext) {init_test(cx, |_| {});@@ -1259,7 +1257,6 @@ fn test_prev_next_word_boundary(cx: &mut TestAppContext) {});}-//todo!(finish editor tests)#[gpui::test]fn test_prev_next_word_bounds_with_soft_wrap(cx: &mut TestAppContext) {init_test(cx, |_| {});@@ -1318,7 +1315,6 @@ fn test_prev_next_word_bounds_with_soft_wrap(cx: &mut TestAppContext) {});}-//todo!(simulate_resize)#[gpui::test]async fn test_move_start_of_paragraph_end_of_paragraph(cx: &mut gpui::TestAppContext) {init_test(cx, |_| {});@@ -2546,7 +2542,6 @@ fn test_delete_line(cx: &mut TestAppContext) {});}-//todo!(select_anchor_ranges)#[gpui::test]fn test_join_lines_with_single_selection(cx: &mut TestAppContext) {init_test(cx, |_| {});@@ -3114,7 +3109,6 @@ fn test_move_line_up_down_with_blocks(cx: &mut TestAppContext) {});}-//todo!(test_transpose)#[gpui::test]fn test_transpose(cx: &mut TestAppContext) {init_test(cx, |_| {});@@ -4860,7 +4854,6 @@ async fn test_delete_autoclose_pair(cx: &mut gpui::TestAppContext) {});}-// todo!(select_anchor_ranges)#[gpui::test]async fn test_snippets(cx: &mut gpui::TestAppContext) {init_test(cx, |_| {});@@ -6455,7 +6448,6 @@ fn test_highlighted_ranges(cx: &mut TestAppContext) {});}-// todo!(following)#[gpui::test]async fn test_following(cx: &mut gpui::TestAppContext) {init_test(cx, |_| {});@@ -7094,7 +7086,6 @@ async fn test_move_to_enclosing_bracket(cx: &mut gpui::TestAppContext) {);}-// todo!(completions)#[gpui::test(iterations = 10)]async fn test_copilot(executor: BackgroundExecutor, cx: &mut gpui::TestAppContext) {// flakydiff --git a/crates/editor/src/movement.rs b/crates/editor/src/movement.rsindex 0b13e25d5dd..72441974c37 100644--- a/crates/editor/src/movement.rs+++ b/crates/editor/src/movement.rs@@ -95,7 +95,7 @@ pub fn up_by_rows(text_layout_details: &TextLayoutDetails,) -> (DisplayPoint, SelectionGoal) {let mut goal_x = match goal {- SelectionGoal::HorizontalPosition(x) => x.into(), // todo!("Can the fields in SelectionGoal by Pixels? We should extract a geometry crate and depend on that.")+ SelectionGoal::HorizontalPosition(x) => x.into(),SelectionGoal::WrappedHorizontalPosition((_, x)) => x.into(),SelectionGoal::HorizontalRange { end, .. } => end.into(),_ => map.x_for_display_point(start, text_layout_details),diff --git a/crates/editor/src/scroll/actions.rs b/crates/editor/src/scroll/actions.rsindex 21a4258f6f1..436a0291d02 100644--- a/crates/editor/src/scroll/actions.rs+++ b/crates/editor/src/scroll/actions.rs@@ -11,10 +11,9 @@ impl Editor {return;}- // todo!()- // if self.mouse_context_menu.read(cx).visible() {- // return None;- // }+ if self.mouse_context_menu.is_some() {+ return;+ }if matches!(self.mode, EditorMode::SingleLine) {cx.propagate();diff --git a/crates/gpui/src/app/test_context.rs b/crates/gpui/src/app/test_context.rsindex de31339b8d7..032d0a7963b 100644--- a/crates/gpui/src/app/test_context.rs+++ b/crates/gpui/src/app/test_context.rs@@ -481,7 +481,7 @@ impl<V> View<V> {use postage::prelude::{Sink as _, Stream as _};let (tx, mut rx) = postage::mpsc::channel(1024);- let timeout_duration = Duration::from_millis(100); //todo!() cx.condition_duration();+ let timeout_duration = Duration::from_millis(100);let mut cx = cx.app.borrow_mut();let subscriptions = (diff --git a/crates/gpui/src/elements/overlay.rs b/crates/gpui/src/elements/overlay.rsindex 6772baa2f9c..019436493d9 100644--- a/crates/gpui/src/elements/overlay.rs+++ b/crates/gpui/src/elements/overlay.rs@@ -15,8 +15,7 @@ pub struct Overlay {anchor_corner: AnchorCorner,fit_mode: OverlayFitMode,anchor_position: Option<Point<Pixels>>,- // todo!();- // position_mode: OverlayPositionMode,+ position_mode: OverlayPositionMode,}/// overlay gives you a floating element that will avoid overflowing the window bounds.@@ -27,6 +26,7 @@ pub fn overlay() -> Overlay {anchor_corner: AnchorCorner::TopLeft,fit_mode: OverlayFitMode::SwitchAnchor,anchor_position: None,+ position_mode: OverlayPositionMode::Window,}}@@ -44,6 +44,14 @@ impl Overlay {self}+ /// Sets the position mode for this overlay. Local will have this+ /// interpret it's [Overlay::position] as relative to the parent element.+ /// While Window will have it interpret the position as relative to the window.+ pub fn position_mode(mut self, mode: OverlayPositionMode) -> Self {+ self.position_mode = mode;+ self+ }+/// Snap to window edge instead of switching anchor corner when an overflow would occur.pub fn snap_to_window(mut self) -> Self {self.fit_mode = OverlayFitMode::SnapToWindow;@@ -100,9 +108,14 @@ impl Element for Overlay {child_max = child_max.max(&child_bounds.lower_right());}let size: Size<Pixels> = (child_max - child_min).into();- let origin = self.anchor_position.unwrap_or(bounds.origin);- let mut desired = self.anchor_corner.get_bounds(origin, size);+ let (origin, mut desired) = self.position_mode.get_position_and_bounds(+ self.anchor_position,+ self.anchor_corner,+ size,+ bounds,+ );+let limits = Bounds {origin: Point::default(),size: cx.viewport_size(),@@ -184,6 +197,35 @@ pub enum OverlayFitMode {SwitchAnchor,}+#[derive(Copy, Clone, PartialEq)]+pub enum OverlayPositionMode {+ Window,+ Local,+}++impl OverlayPositionMode {+ fn get_position_and_bounds(+ &self,+ anchor_position: Option<Point<Pixels>>,+ anchor_corner: AnchorCorner,+ size: Size<Pixels>,+ bounds: Bounds<Pixels>,+ ) -> (Point<Pixels>, Bounds<Pixels>) {+ match self {+ OverlayPositionMode::Window => {+ let anchor_position = anchor_position.unwrap_or_else(|| bounds.origin);+ let bounds = anchor_corner.get_bounds(anchor_position, size);+ (anchor_position, bounds)+ }+ OverlayPositionMode::Local => {+ let anchor_position = anchor_position.unwrap_or_default();+ let bounds = anchor_corner.get_bounds(bounds.origin + anchor_position, size);+ (anchor_position, bounds)+ }+ }+ }+}+#[derive(Clone, Copy, PartialEq, Eq)]pub enum AnchorCorner {TopLeft,diff --git a/crates/text/src/selection.rs b/crates/text/src/selection.rsindex 4f1f9a29223..480cb99d747 100644--- a/crates/text/src/selection.rs+++ b/crates/text/src/selection.rs@@ -5,7 +5,7 @@ use std::ops::Range;#[derive(Copy, Clone, Debug, PartialEq)]pub enum SelectionGoal {None,- HorizontalPosition(f32), // todo!("Can we use pixels here without adding a runtime gpui dependency?")+ HorizontalPosition(f32),HorizontalRange { start: f32, end: f32 },WrappedHorizontalPosition((u32, f32)),}