mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 12:54:42 +00:00
Fix / remove small todos
This commit is contained in:
parent
145f3f55e9
commit
80790d921d
11 changed files with 52 additions and 34 deletions
|
@ -262,7 +262,6 @@ async fn test_remove_channel_message(
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn assert_messages(chat: &Model<ChannelChat>, messages: &[&str], cx: &mut TestAppContext) {
|
fn assert_messages(chat: &Model<ChannelChat>, messages: &[&str], cx: &mut TestAppContext) {
|
||||||
// todo!(don't directly borrow here)
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
chat.read_with(cx, |chat, _| {
|
chat.read_with(cx, |chat, _| {
|
||||||
chat.messages()
|
chat.messages()
|
||||||
|
|
|
@ -41,12 +41,6 @@ pub fn init(cx: &mut AppContext) {
|
||||||
workspace.set_titlebar_item(titlebar_item.into(), cx)
|
workspace.set_titlebar_item(titlebar_item.into(), cx)
|
||||||
})
|
})
|
||||||
.detach();
|
.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 {
|
pub struct CollabTitlebarItem {
|
||||||
|
|
|
@ -19,7 +19,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
|
||||||
for window in notification_windows.drain(..) {
|
for window in notification_windows.drain(..) {
|
||||||
window
|
window
|
||||||
.update(&mut cx, |_, cx| {
|
.update(&mut cx, |_, cx| {
|
||||||
// todo!()
|
|
||||||
cx.remove_window();
|
cx.remove_window();
|
||||||
})
|
})
|
||||||
.log_err();
|
.log_err();
|
||||||
|
|
|
@ -51,7 +51,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
|
||||||
for window in windows {
|
for window in windows {
|
||||||
window
|
window
|
||||||
.update(cx, |_, cx| {
|
.update(cx, |_, cx| {
|
||||||
// todo!()
|
|
||||||
cx.remove_window();
|
cx.remove_window();
|
||||||
})
|
})
|
||||||
.ok();
|
.ok();
|
||||||
|
@ -64,7 +63,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
|
||||||
for window in windows {
|
for window in windows {
|
||||||
window
|
window
|
||||||
.update(cx, |_, cx| {
|
.update(cx, |_, cx| {
|
||||||
// todo!()
|
|
||||||
cx.remove_window();
|
cx.remove_window();
|
||||||
})
|
})
|
||||||
.ok();
|
.ok();
|
||||||
|
|
|
@ -1829,10 +1829,6 @@ impl Editor {
|
||||||
this.end_selection(cx);
|
this.end_selection(cx);
|
||||||
this.scroll_manager.show_scrollbar(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 {
|
if mode == EditorMode::Full {
|
||||||
let should_auto_hide_scrollbars = cx.should_auto_hide_scrollbars();
|
let should_auto_hide_scrollbars = cx.should_auto_hide_scrollbars();
|
||||||
cx.set_global(ScrollbarAutoHide(should_auto_hide_scrollbars));
|
cx.set_global(ScrollbarAutoHide(should_auto_hide_scrollbars));
|
||||||
|
|
|
@ -539,7 +539,6 @@ fn test_clone(cx: &mut TestAppContext) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo!(editor navigate)
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_navigation_history(cx: &mut TestAppContext) {
|
async fn test_navigation_history(cx: &mut TestAppContext) {
|
||||||
init_test(cx, |_| {});
|
init_test(cx, |_| {});
|
||||||
|
@ -993,7 +992,6 @@ fn test_move_cursor_multibyte(cx: &mut TestAppContext) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo!(finish editor tests)
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
fn test_move_cursor_different_line_lengths(cx: &mut TestAppContext) {
|
fn test_move_cursor_different_line_lengths(cx: &mut TestAppContext) {
|
||||||
init_test(cx, |_| {});
|
init_test(cx, |_| {});
|
||||||
|
@ -1259,7 +1257,6 @@ fn test_prev_next_word_boundary(cx: &mut TestAppContext) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo!(finish editor tests)
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
fn test_prev_next_word_bounds_with_soft_wrap(cx: &mut TestAppContext) {
|
fn test_prev_next_word_bounds_with_soft_wrap(cx: &mut TestAppContext) {
|
||||||
init_test(cx, |_| {});
|
init_test(cx, |_| {});
|
||||||
|
@ -1318,7 +1315,6 @@ fn test_prev_next_word_bounds_with_soft_wrap(cx: &mut TestAppContext) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo!(simulate_resize)
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_move_start_of_paragraph_end_of_paragraph(cx: &mut gpui::TestAppContext) {
|
async fn test_move_start_of_paragraph_end_of_paragraph(cx: &mut gpui::TestAppContext) {
|
||||||
init_test(cx, |_| {});
|
init_test(cx, |_| {});
|
||||||
|
@ -2546,7 +2542,6 @@ fn test_delete_line(cx: &mut TestAppContext) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo!(select_anchor_ranges)
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
fn test_join_lines_with_single_selection(cx: &mut TestAppContext) {
|
fn test_join_lines_with_single_selection(cx: &mut TestAppContext) {
|
||||||
init_test(cx, |_| {});
|
init_test(cx, |_| {});
|
||||||
|
@ -3114,7 +3109,6 @@ fn test_move_line_up_down_with_blocks(cx: &mut TestAppContext) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo!(test_transpose)
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
fn test_transpose(cx: &mut TestAppContext) {
|
fn test_transpose(cx: &mut TestAppContext) {
|
||||||
init_test(cx, |_| {});
|
init_test(cx, |_| {});
|
||||||
|
@ -4860,7 +4854,6 @@ async fn test_delete_autoclose_pair(cx: &mut gpui::TestAppContext) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo!(select_anchor_ranges)
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_snippets(cx: &mut gpui::TestAppContext) {
|
async fn test_snippets(cx: &mut gpui::TestAppContext) {
|
||||||
init_test(cx, |_| {});
|
init_test(cx, |_| {});
|
||||||
|
@ -6455,7 +6448,6 @@ fn test_highlighted_ranges(cx: &mut TestAppContext) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo!(following)
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_following(cx: &mut gpui::TestAppContext) {
|
async fn test_following(cx: &mut gpui::TestAppContext) {
|
||||||
init_test(cx, |_| {});
|
init_test(cx, |_| {});
|
||||||
|
@ -7094,7 +7086,6 @@ async fn test_move_to_enclosing_bracket(cx: &mut gpui::TestAppContext) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo!(completions)
|
|
||||||
#[gpui::test(iterations = 10)]
|
#[gpui::test(iterations = 10)]
|
||||||
async fn test_copilot(executor: BackgroundExecutor, cx: &mut gpui::TestAppContext) {
|
async fn test_copilot(executor: BackgroundExecutor, cx: &mut gpui::TestAppContext) {
|
||||||
// flaky
|
// flaky
|
||||||
|
|
|
@ -95,7 +95,7 @@ pub fn up_by_rows(
|
||||||
text_layout_details: &TextLayoutDetails,
|
text_layout_details: &TextLayoutDetails,
|
||||||
) -> (DisplayPoint, SelectionGoal) {
|
) -> (DisplayPoint, SelectionGoal) {
|
||||||
let mut goal_x = match goal {
|
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::WrappedHorizontalPosition((_, x)) => x.into(),
|
||||||
SelectionGoal::HorizontalRange { end, .. } => end.into(),
|
SelectionGoal::HorizontalRange { end, .. } => end.into(),
|
||||||
_ => map.x_for_display_point(start, text_layout_details),
|
_ => map.x_for_display_point(start, text_layout_details),
|
||||||
|
|
|
@ -11,10 +11,9 @@ impl Editor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo!()
|
if self.mouse_context_menu.is_some() {
|
||||||
// if self.mouse_context_menu.read(cx).visible() {
|
return;
|
||||||
// return None;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
if matches!(self.mode, EditorMode::SingleLine) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
|
|
|
@ -481,7 +481,7 @@ impl<V> View<V> {
|
||||||
use postage::prelude::{Sink as _, Stream as _};
|
use postage::prelude::{Sink as _, Stream as _};
|
||||||
|
|
||||||
let (tx, mut rx) = postage::mpsc::channel(1024);
|
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 mut cx = cx.app.borrow_mut();
|
||||||
let subscriptions = (
|
let subscriptions = (
|
||||||
|
|
|
@ -15,8 +15,7 @@ pub struct Overlay {
|
||||||
anchor_corner: AnchorCorner,
|
anchor_corner: AnchorCorner,
|
||||||
fit_mode: OverlayFitMode,
|
fit_mode: OverlayFitMode,
|
||||||
anchor_position: Option<Point<Pixels>>,
|
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.
|
/// 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,
|
anchor_corner: AnchorCorner::TopLeft,
|
||||||
fit_mode: OverlayFitMode::SwitchAnchor,
|
fit_mode: OverlayFitMode::SwitchAnchor,
|
||||||
anchor_position: None,
|
anchor_position: None,
|
||||||
|
position_mode: OverlayPositionMode::Window,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,14 @@ impl Overlay {
|
||||||
self
|
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.
|
/// Snap to window edge instead of switching anchor corner when an overflow would occur.
|
||||||
pub fn snap_to_window(mut self) -> Self {
|
pub fn snap_to_window(mut self) -> Self {
|
||||||
self.fit_mode = OverlayFitMode::SnapToWindow;
|
self.fit_mode = OverlayFitMode::SnapToWindow;
|
||||||
|
@ -100,9 +108,14 @@ impl Element for Overlay {
|
||||||
child_max = child_max.max(&child_bounds.lower_right());
|
child_max = child_max.max(&child_bounds.lower_right());
|
||||||
}
|
}
|
||||||
let size: Size<Pixels> = (child_max - child_min).into();
|
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 {
|
let limits = Bounds {
|
||||||
origin: Point::default(),
|
origin: Point::default(),
|
||||||
size: cx.viewport_size(),
|
size: cx.viewport_size(),
|
||||||
|
@ -184,6 +197,35 @@ pub enum OverlayFitMode {
|
||||||
SwitchAnchor,
|
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)]
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum AnchorCorner {
|
pub enum AnchorCorner {
|
||||||
TopLeft,
|
TopLeft,
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std::ops::Range;
|
||||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
pub enum SelectionGoal {
|
pub enum SelectionGoal {
|
||||||
None,
|
None,
|
||||||
HorizontalPosition(f32), // todo!("Can we use pixels here without adding a runtime gpui dependency?")
|
HorizontalPosition(f32),
|
||||||
HorizontalRange { start: f32, end: f32 },
|
HorizontalRange { start: f32, end: f32 },
|
||||||
WrappedHorizontalPosition((u32, f32)),
|
WrappedHorizontalPosition((u32, f32)),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue