Remove or fix stale todos (#3990)
The software equivalent of dusting Release Notes: -
This commit is contained in:
commit
45baad2825
38 changed files with 186 additions and 360 deletions
|
@ -77,9 +77,6 @@ impl ActivityIndicator {
|
||||||
cx.observe(auto_updater, |_, _, cx| cx.notify()).detach();
|
cx.observe(auto_updater, |_, _, cx| cx.notify()).detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
// cx.observe_active_labeled_tasks(|_, cx| cx.notify())
|
|
||||||
// .detach();
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
statuses: Default::default(),
|
statuses: Default::default(),
|
||||||
project: project.clone(),
|
project: project.clone(),
|
||||||
|
@ -288,15 +285,6 @@ impl ActivityIndicator {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo!(show active tasks)
|
|
||||||
// if let Some(most_recent_active_task) = cx.active_labeled_tasks().last() {
|
|
||||||
// return Content {
|
|
||||||
// icon: None,
|
|
||||||
// message: most_recent_active_task.to_string(),
|
|
||||||
// on_click: None,
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
Default::default()
|
Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -71,6 +71,7 @@ async fn test_host_disconnect(
|
||||||
let workspace_b =
|
let workspace_b =
|
||||||
cx_b.add_window(|cx| Workspace::new(0, project_b.clone(), client_b.app_state.clone(), cx));
|
cx_b.add_window(|cx| Workspace::new(0, project_b.clone(), client_b.app_state.clone(), cx));
|
||||||
let cx_b = &mut VisualTestContext::from_window(*workspace_b, cx_b);
|
let cx_b = &mut VisualTestContext::from_window(*workspace_b, cx_b);
|
||||||
|
let workspace_b_view = workspace_b.root_view(cx_b).unwrap();
|
||||||
|
|
||||||
let editor_b = workspace_b
|
let editor_b = workspace_b
|
||||||
.update(cx_b, |workspace, cx| {
|
.update(cx_b, |workspace, cx| {
|
||||||
|
@ -85,8 +86,10 @@ async fn test_host_disconnect(
|
||||||
//TODO: focus
|
//TODO: focus
|
||||||
assert!(cx_b.update_view(&editor_b, |editor, cx| editor.is_focused(cx)));
|
assert!(cx_b.update_view(&editor_b, |editor, cx| editor.is_focused(cx)));
|
||||||
editor_b.update(cx_b, |editor, cx| editor.insert("X", cx));
|
editor_b.update(cx_b, |editor, cx| editor.insert("X", cx));
|
||||||
//todo(is_edited)
|
|
||||||
// assert!(workspace_b.is_edited(cx_b));
|
cx_b.update(|cx| {
|
||||||
|
assert!(workspace_b_view.read(cx).is_edited());
|
||||||
|
});
|
||||||
|
|
||||||
// Drop client A's connection. Collaborators should disappear and the project should not be shown as shared.
|
// Drop client A's connection. Collaborators should disappear and the project should not be shown as shared.
|
||||||
server.forbid_connections();
|
server.forbid_connections();
|
||||||
|
@ -105,11 +108,11 @@ async fn test_host_disconnect(
|
||||||
// Ensure client B's edited state is reset and that the whole window is blurred.
|
// Ensure client B's edited state is reset and that the whole window is blurred.
|
||||||
|
|
||||||
workspace_b
|
workspace_b
|
||||||
.update(cx_b, |_, cx| {
|
.update(cx_b, |workspace, cx| {
|
||||||
assert_eq!(cx.focused(), None);
|
assert_eq!(cx.focused(), None);
|
||||||
|
assert!(!workspace.is_edited())
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
// assert!(!workspace_b.is_edited(cx_b));
|
|
||||||
|
|
||||||
// Ensure client B is not prompted to save edits when closing window after disconnecting.
|
// Ensure client B is not prompted to save edits when closing window after disconnecting.
|
||||||
let can_close = workspace_b
|
let can_close = workspace_b
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -25,6 +25,7 @@ pub struct TestAppContext {
|
||||||
pub dispatcher: TestDispatcher,
|
pub dispatcher: TestDispatcher,
|
||||||
test_platform: Rc<TestPlatform>,
|
test_platform: Rc<TestPlatform>,
|
||||||
text_system: Arc<TextSystem>,
|
text_system: Arc<TextSystem>,
|
||||||
|
fn_name: Option<&'static str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Context for TestAppContext {
|
impl Context for TestAppContext {
|
||||||
|
@ -85,7 +86,7 @@ impl Context for TestAppContext {
|
||||||
|
|
||||||
impl TestAppContext {
|
impl TestAppContext {
|
||||||
/// Creates a new `TestAppContext`. Usually you can rely on `#[gpui::test]` to do this for you.
|
/// Creates a new `TestAppContext`. Usually you can rely on `#[gpui::test]` to do this for you.
|
||||||
pub fn new(dispatcher: TestDispatcher) -> Self {
|
pub fn new(dispatcher: TestDispatcher, fn_name: Option<&'static str>) -> Self {
|
||||||
let arc_dispatcher = Arc::new(dispatcher.clone());
|
let arc_dispatcher = Arc::new(dispatcher.clone());
|
||||||
let background_executor = BackgroundExecutor::new(arc_dispatcher.clone());
|
let background_executor = BackgroundExecutor::new(arc_dispatcher.clone());
|
||||||
let foreground_executor = ForegroundExecutor::new(arc_dispatcher);
|
let foreground_executor = ForegroundExecutor::new(arc_dispatcher);
|
||||||
|
@ -101,12 +102,23 @@ impl TestAppContext {
|
||||||
dispatcher: dispatcher.clone(),
|
dispatcher: dispatcher.clone(),
|
||||||
test_platform: platform,
|
test_platform: platform,
|
||||||
text_system,
|
text_system,
|
||||||
|
fn_name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The name of the test function that created this `TestAppContext`
|
||||||
|
pub fn test_function_name(&self) -> Option<&'static str> {
|
||||||
|
self.fn_name
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Checks whether there have been any new path prompts received by the platform.
|
||||||
|
pub fn did_prompt_for_new_path(&self) -> bool {
|
||||||
|
self.test_platform.did_prompt_for_new_path()
|
||||||
|
}
|
||||||
|
|
||||||
/// returns a new `TestAppContext` re-using the same executors to interleave tasks.
|
/// returns a new `TestAppContext` re-using the same executors to interleave tasks.
|
||||||
pub fn new_app(&self) -> TestAppContext {
|
pub fn new_app(&self) -> TestAppContext {
|
||||||
Self::new(self.dispatcher.clone())
|
Self::new(self.dispatcher.clone(), self.fn_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Simulates quitting the app.
|
/// Simulates quitting the app.
|
||||||
|
@ -481,7 +493,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 = (
|
||||||
|
|
|
@ -1003,7 +1003,7 @@ impl Interactivity {
|
||||||
if let Some(text) = cx
|
if let Some(text) = cx
|
||||||
.text_system()
|
.text_system()
|
||||||
.shape_text(
|
.shape_text(
|
||||||
&element_id,
|
element_id.into(),
|
||||||
FONT_SIZE,
|
FONT_SIZE,
|
||||||
&[cx.text_style().to_run(str_len)],
|
&[cx.text_style().to_run(str_len)],
|
||||||
None,
|
None,
|
||||||
|
@ -1055,22 +1055,11 @@ impl Interactivity {
|
||||||
};
|
};
|
||||||
|
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"This element is created at:\n{}:{}:{}",
|
"This element was created at:\n{}:{}:{}",
|
||||||
location.file(),
|
dir.join(location.file()).to_string_lossy(),
|
||||||
location.line(),
|
location.line(),
|
||||||
location.column()
|
location.column()
|
||||||
);
|
);
|
||||||
|
|
||||||
std::process::Command::new("zed")
|
|
||||||
.arg(format!(
|
|
||||||
"{}/{}:{}:{}",
|
|
||||||
dir.to_string_lossy(),
|
|
||||||
location.file(),
|
|
||||||
location.line(),
|
|
||||||
location.column()
|
|
||||||
))
|
|
||||||
.spawn()
|
|
||||||
.ok();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -202,7 +202,10 @@ impl TextState {
|
||||||
let Some(lines) = cx
|
let Some(lines) = cx
|
||||||
.text_system()
|
.text_system()
|
||||||
.shape_text(
|
.shape_text(
|
||||||
&text, font_size, &runs, wrap_width, // Wrap if we know the width.
|
text.clone(),
|
||||||
|
font_size,
|
||||||
|
&runs,
|
||||||
|
wrap_width, // Wrap if we know the width.
|
||||||
)
|
)
|
||||||
.log_err()
|
.log_err()
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -102,6 +102,10 @@ impl TestPlatform {
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn did_prompt_for_new_path(&self) -> bool {
|
||||||
|
self.prompts.borrow().new_path.len() > 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Platform for TestPlatform {
|
impl Platform for TestPlatform {
|
||||||
|
@ -278,8 +282,7 @@ impl Platform for TestPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn should_auto_hide_scrollbars(&self) -> bool {
|
fn should_auto_hide_scrollbars(&self) -> bool {
|
||||||
// todo()
|
false
|
||||||
true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_to_clipboard(&self, item: ClipboardItem) {
|
fn write_to_clipboard(&self, item: ClipboardItem) {
|
||||||
|
|
|
@ -165,7 +165,8 @@ impl Default for TextStyle {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
TextStyle {
|
TextStyle {
|
||||||
color: black(),
|
color: black(),
|
||||||
font_family: "Helvetica".into(), // todo!("Get a font we know exists on the system")
|
// Helvetica is a web safe font, so it should be available
|
||||||
|
font_family: "Helvetica".into(),
|
||||||
font_features: FontFeatures::default(),
|
font_features: FontFeatures::default(),
|
||||||
font_size: rems(1.).into(),
|
font_size: rems(1.).into(),
|
||||||
line_height: phi(),
|
line_height: phi(),
|
||||||
|
|
|
@ -39,7 +39,6 @@ pub fn run_test(
|
||||||
max_retries: usize,
|
max_retries: usize,
|
||||||
test_fn: &mut (dyn RefUnwindSafe + Fn(TestDispatcher, u64)),
|
test_fn: &mut (dyn RefUnwindSafe + Fn(TestDispatcher, u64)),
|
||||||
on_fail_fn: Option<fn()>,
|
on_fail_fn: Option<fn()>,
|
||||||
_fn_name: String, // todo!("re-enable fn_name")
|
|
||||||
) {
|
) {
|
||||||
let starting_seed = env::var("SEED")
|
let starting_seed = env::var("SEED")
|
||||||
.map(|seed| seed.parse().expect("invalid SEED variable"))
|
.map(|seed| seed.parse().expect("invalid SEED variable"))
|
||||||
|
|
|
@ -258,7 +258,7 @@ impl TextSystem {
|
||||||
|
|
||||||
pub fn shape_text(
|
pub fn shape_text(
|
||||||
&self,
|
&self,
|
||||||
text: &str, // todo!("pass a SharedString and preserve it when passed a single line?")
|
text: SharedString,
|
||||||
font_size: Pixels,
|
font_size: Pixels,
|
||||||
runs: &[TextRun],
|
runs: &[TextRun],
|
||||||
wrap_width: Option<Pixels>,
|
wrap_width: Option<Pixels>,
|
||||||
|
@ -268,8 +268,8 @@ impl TextSystem {
|
||||||
|
|
||||||
let mut lines = SmallVec::new();
|
let mut lines = SmallVec::new();
|
||||||
let mut line_start = 0;
|
let mut line_start = 0;
|
||||||
for line_text in text.split('\n') {
|
|
||||||
let line_text = SharedString::from(line_text.to_string());
|
let mut process_line = |line_text: SharedString| {
|
||||||
let line_end = line_start + line_text.len();
|
let line_end = line_start + line_text.len();
|
||||||
|
|
||||||
let mut last_font: Option<Font> = None;
|
let mut last_font: Option<Font> = None;
|
||||||
|
@ -335,6 +335,24 @@ impl TextSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
font_runs.clear();
|
font_runs.clear();
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut split_lines = text.split('\n');
|
||||||
|
let mut processed = false;
|
||||||
|
|
||||||
|
if let Some(first_line) = split_lines.next() {
|
||||||
|
if let Some(second_line) = split_lines.next() {
|
||||||
|
processed = true;
|
||||||
|
process_line(first_line.to_string().into());
|
||||||
|
process_line(second_line.to_string().into());
|
||||||
|
for line_text in split_lines {
|
||||||
|
process_line(line_text.to_string().into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !processed {
|
||||||
|
process_line(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.font_runs_pool.lock().push(font_runs);
|
self.font_runs_pool.lock().push(font_runs);
|
||||||
|
|
|
@ -143,7 +143,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_wrap_line() {
|
fn test_wrap_line() {
|
||||||
let dispatcher = TestDispatcher::new(StdRng::seed_from_u64(0));
|
let dispatcher = TestDispatcher::new(StdRng::seed_from_u64(0));
|
||||||
let cx = TestAppContext::new(dispatcher);
|
let cx = TestAppContext::new(dispatcher, None);
|
||||||
|
|
||||||
cx.update(|cx| {
|
cx.update(|cx| {
|
||||||
let text_system = cx.text_system().clone();
|
let text_system = cx.text_system().clone();
|
||||||
|
|
|
@ -1474,9 +1474,7 @@ impl<'a> WindowContext<'a> {
|
||||||
InputEvent::MouseUp(mouse_up)
|
InputEvent::MouseUp(mouse_up)
|
||||||
}
|
}
|
||||||
InputEvent::MouseExited(mouse_exited) => {
|
InputEvent::MouseExited(mouse_exited) => {
|
||||||
// todo!("Should we record that the mouse is outside of the window somehow? Or are these global pixels?")
|
|
||||||
self.window.modifiers = mouse_exited.modifiers;
|
self.window.modifiers = mouse_exited.modifiers;
|
||||||
|
|
||||||
InputEvent::MouseExited(mouse_exited)
|
InputEvent::MouseExited(mouse_exited)
|
||||||
}
|
}
|
||||||
InputEvent::ModifiersChanged(modifiers_changed) => {
|
InputEvent::ModifiersChanged(modifiers_changed) => {
|
||||||
|
|
|
@ -106,7 +106,8 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
|
||||||
let cx_varname = format_ident!("cx_{}", ix);
|
let cx_varname = format_ident!("cx_{}", ix);
|
||||||
cx_vars.extend(quote!(
|
cx_vars.extend(quote!(
|
||||||
let mut #cx_varname = gpui::TestAppContext::new(
|
let mut #cx_varname = gpui::TestAppContext::new(
|
||||||
dispatcher.clone()
|
dispatcher.clone(),
|
||||||
|
Some(stringify!(#outer_fn_name)),
|
||||||
);
|
);
|
||||||
));
|
));
|
||||||
cx_teardowns.extend(quote!(
|
cx_teardowns.extend(quote!(
|
||||||
|
@ -140,8 +141,7 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
|
||||||
executor.block_test(#inner_fn_name(#inner_fn_args));
|
executor.block_test(#inner_fn_name(#inner_fn_args));
|
||||||
#cx_teardowns
|
#cx_teardowns
|
||||||
},
|
},
|
||||||
#on_failure_fn_name,
|
#on_failure_fn_name
|
||||||
stringify!(#outer_fn_name).to_string(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,8 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
|
||||||
let cx_varname_lock = format_ident!("cx_{}_lock", ix);
|
let cx_varname_lock = format_ident!("cx_{}_lock", ix);
|
||||||
cx_vars.extend(quote!(
|
cx_vars.extend(quote!(
|
||||||
let mut #cx_varname = gpui::TestAppContext::new(
|
let mut #cx_varname = gpui::TestAppContext::new(
|
||||||
dispatcher.clone()
|
dispatcher.clone(),
|
||||||
|
Some(stringify!(#outer_fn_name))
|
||||||
);
|
);
|
||||||
let mut #cx_varname_lock = #cx_varname.app.borrow_mut();
|
let mut #cx_varname_lock = #cx_varname.app.borrow_mut();
|
||||||
));
|
));
|
||||||
|
@ -186,7 +187,8 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
|
||||||
let cx_varname = format_ident!("cx_{}", ix);
|
let cx_varname = format_ident!("cx_{}", ix);
|
||||||
cx_vars.extend(quote!(
|
cx_vars.extend(quote!(
|
||||||
let mut #cx_varname = gpui::TestAppContext::new(
|
let mut #cx_varname = gpui::TestAppContext::new(
|
||||||
dispatcher.clone()
|
dispatcher.clone(),
|
||||||
|
Some(stringify!(#outer_fn_name))
|
||||||
);
|
);
|
||||||
));
|
));
|
||||||
cx_teardowns.extend(quote!(
|
cx_teardowns.extend(quote!(
|
||||||
|
@ -222,7 +224,6 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
|
||||||
#cx_teardowns
|
#cx_teardowns
|
||||||
},
|
},
|
||||||
#on_failure_fn_name,
|
#on_failure_fn_name,
|
||||||
stringify!(#outer_fn_name).to_string(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::{sync::Arc, time::Duration};
|
use std::{sync::Arc, time::Duration};
|
||||||
|
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use gpui::{actions, KeyBinding};
|
use gpui::{actions, KeyBinding, Menu, MenuItem};
|
||||||
use live_kit_client::{
|
use live_kit_client::{
|
||||||
LocalAudioTrack, LocalVideoTrack, RemoteAudioTrackUpdate, RemoteVideoTrackUpdate, Room,
|
LocalAudioTrack, LocalVideoTrack, RemoteAudioTrackUpdate, RemoteVideoTrackUpdate, Room,
|
||||||
};
|
};
|
||||||
|
@ -26,15 +26,14 @@ fn main() {
|
||||||
cx.on_action(quit);
|
cx.on_action(quit);
|
||||||
cx.bind_keys([KeyBinding::new("cmd-q", Quit, None)]);
|
cx.bind_keys([KeyBinding::new("cmd-q", Quit, None)]);
|
||||||
|
|
||||||
// todo!()
|
cx.set_menus(vec![Menu {
|
||||||
// cx.set_menus(vec![Menu {
|
name: "Zed",
|
||||||
// name: "Zed",
|
items: vec![MenuItem::Action {
|
||||||
// items: vec![MenuItem::Action {
|
name: "Quit",
|
||||||
// name: "Quit",
|
action: Box::new(Quit),
|
||||||
// action: Box::new(Quit),
|
os_action: None,
|
||||||
// os_action: None,
|
}],
|
||||||
// }],
|
}]);
|
||||||
// }]);
|
|
||||||
|
|
||||||
let live_kit_url = std::env::var("LIVE_KIT_URL").unwrap_or("http://localhost:7880".into());
|
let live_kit_url = std::env::var("LIVE_KIT_URL").unwrap_or("http://localhost:7880".into());
|
||||||
let live_kit_key = std::env::var("LIVE_KIT_KEY").unwrap_or("devkey".into());
|
let live_kit_key = std::env::var("LIVE_KIT_KEY").unwrap_or("devkey".into());
|
||||||
|
|
|
@ -242,7 +242,6 @@ impl PickerDelegate for ProjectSymbolsDelegate {
|
||||||
.spacing(ListItemSpacing::Sparse)
|
.spacing(ListItemSpacing::Sparse)
|
||||||
.selected(selected)
|
.selected(selected)
|
||||||
.child(
|
.child(
|
||||||
// todo!() combine_syntax_and_fuzzy_match_highlights()
|
|
||||||
v_stack()
|
v_stack()
|
||||||
.child(
|
.child(
|
||||||
LabelLike::new().child(
|
LabelLike::new().child(
|
||||||
|
|
|
@ -424,7 +424,6 @@ impl TerminalElement {
|
||||||
let line_height = font_pixels * line_height.to_pixels(rem_size);
|
let line_height = font_pixels * line_height.to_pixels(rem_size);
|
||||||
let font_id = cx.text_system().resolve_font(&text_style.font());
|
let font_id = cx.text_system().resolve_font(&text_style.font());
|
||||||
|
|
||||||
// todo!(do we need to keep this unwrap?)
|
|
||||||
let cell_width = text_system
|
let cell_width = text_system
|
||||||
.advance(font_id, font_pixels, 'm')
|
.advance(font_id, font_pixels, 'm')
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -524,7 +523,6 @@ impl TerminalElement {
|
||||||
underline: Default::default(),
|
underline: Default::default(),
|
||||||
}],
|
}],
|
||||||
)
|
)
|
||||||
//todo!(do we need to keep this unwrap?)
|
|
||||||
.unwrap()
|
.unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -664,21 +662,6 @@ impl TerminalElement {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
self.interactivity.on_click({
|
|
||||||
let terminal = terminal.clone();
|
|
||||||
move |e, cx| {
|
|
||||||
if e.down.button == MouseButton::Right {
|
|
||||||
let mouse_mode = terminal.update(cx, |terminal, _cx| {
|
|
||||||
terminal.mouse_mode(e.down.modifiers.shift)
|
|
||||||
});
|
|
||||||
|
|
||||||
if !mouse_mode {
|
|
||||||
//todo!(context menu)
|
|
||||||
// view.deploy_context_menu(e.position, cx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
self.interactivity.on_scroll_wheel({
|
self.interactivity.on_scroll_wheel({
|
||||||
let terminal = terminal.clone();
|
let terminal = terminal.clone();
|
||||||
move |e, cx| {
|
move |e, cx| {
|
||||||
|
|
|
@ -651,8 +651,10 @@ impl Render for TerminalView {
|
||||||
.on_mouse_down(
|
.on_mouse_down(
|
||||||
MouseButton::Right,
|
MouseButton::Right,
|
||||||
cx.listener(|this, event: &MouseDownEvent, cx| {
|
cx.listener(|this, event: &MouseDownEvent, cx| {
|
||||||
|
if !this.terminal.read(cx).mouse_mode(event.modifiers.shift) {
|
||||||
this.deploy_context_menu(event.position, cx);
|
this.deploy_context_menu(event.position, cx);
|
||||||
cx.notify();
|
cx.notify();
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
|
|
|
@ -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)),
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,7 @@ pub struct ThemeStyles {
|
||||||
|
|
||||||
#[refineable]
|
#[refineable]
|
||||||
pub status: StatusColors,
|
pub status: StatusColors,
|
||||||
|
|
||||||
pub player: PlayerColors,
|
pub player: PlayerColors,
|
||||||
pub syntax: Arc<SyntaxTheme>,
|
pub syntax: Arc<SyntaxTheme>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,12 +122,10 @@ impl PlayerColors {
|
||||||
|
|
||||||
impl PlayerColors {
|
impl PlayerColors {
|
||||||
pub fn local(&self) -> PlayerColor {
|
pub fn local(&self) -> PlayerColor {
|
||||||
// todo!("use a valid color");
|
|
||||||
*self.0.first().unwrap()
|
*self.0.first().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn absent(&self) -> PlayerColor {
|
pub fn absent(&self) -> PlayerColor {
|
||||||
// todo!("use a valid color");
|
|
||||||
*self.0.last().unwrap()
|
*self.0.last().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ use workspace::{ModalView, Toast, Workspace};
|
||||||
actions!(branches, [OpenRecent]);
|
actions!(branches, [OpenRecent]);
|
||||||
|
|
||||||
pub fn init(cx: &mut AppContext) {
|
pub fn init(cx: &mut AppContext) {
|
||||||
// todo!() po
|
|
||||||
cx.observe_new_views(|workspace: &mut Workspace, _| {
|
cx.observe_new_views(|workspace: &mut Workspace, _| {
|
||||||
workspace.register_action(|workspace, action, cx| {
|
workspace.register_action(|workspace, action, cx| {
|
||||||
BranchList::toggle_modal(workspace, action, cx).log_err();
|
BranchList::toggle_modal(workspace, action, cx).log_err();
|
||||||
|
|
|
@ -6,7 +6,7 @@ use editor::test::{
|
||||||
use futures::Future;
|
use futures::Future;
|
||||||
use gpui::{Context, View, VisualContext};
|
use gpui::{Context, View, VisualContext};
|
||||||
use lsp::request;
|
use lsp::request;
|
||||||
use search::BufferSearchBar;
|
use search::{project_search::ProjectSearchBar, BufferSearchBar};
|
||||||
|
|
||||||
use crate::{state::Operator, *};
|
use crate::{state::Operator, *};
|
||||||
|
|
||||||
|
@ -59,9 +59,9 @@ impl VimTestContext {
|
||||||
pane.toolbar().update(cx, |toolbar, cx| {
|
pane.toolbar().update(cx, |toolbar, cx| {
|
||||||
let buffer_search_bar = cx.new_view(BufferSearchBar::new);
|
let buffer_search_bar = cx.new_view(BufferSearchBar::new);
|
||||||
toolbar.add_item(buffer_search_bar, cx);
|
toolbar.add_item(buffer_search_bar, cx);
|
||||||
// todo!();
|
|
||||||
// let project_search_bar = cx.add_view(|_| ProjectSearchBar::new());
|
let project_search_bar = cx.new_view(|_| ProjectSearchBar::new());
|
||||||
// toolbar.add_item(project_search_bar, cx);
|
toolbar.add_item(project_search_bar, cx);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
workspace.status_bar().update(cx, |status_bar, cx| {
|
workspace.status_bar().update(cx, |status_bar, cx| {
|
||||||
|
|
|
@ -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 {
|
pub fn axis(&self) -> Axis {
|
||||||
match self {
|
match self {
|
||||||
Self::Left | Self::Right => Axis::Horizontal,
|
Self::Left | Self::Right => Axis::Horizontal,
|
||||||
|
@ -186,8 +177,6 @@ impl DockPosition {
|
||||||
|
|
||||||
struct PanelEntry {
|
struct PanelEntry {
|
||||||
panel: Arc<dyn PanelHandle>,
|
panel: Arc<dyn PanelHandle>,
|
||||||
// todo!()
|
|
||||||
// context_menu: View<ContextMenu>,
|
|
||||||
_subscriptions: [Subscription; 2],
|
_subscriptions: [Subscription; 2],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,12 +254,6 @@ impl Dock {
|
||||||
self.is_open
|
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>> {
|
pub fn panel<T: Panel>(&self) -> Option<View<T>> {
|
||||||
self.panel_entries
|
self.panel_entries
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -417,16 +400,8 @@ impl Dock {
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
// todo!()
|
|
||||||
// let dock_view_id = cx.view_id();
|
|
||||||
self.panel_entries.push(PanelEntry {
|
self.panel_entries.push(PanelEntry {
|
||||||
panel: Arc::new(panel),
|
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,
|
_subscriptions: subscriptions,
|
||||||
});
|
});
|
||||||
cx.notify()
|
cx.notify()
|
||||||
|
@ -618,7 +593,6 @@ impl PanelButtons {
|
||||||
|
|
||||||
impl Render for PanelButtons {
|
impl Render for PanelButtons {
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||||
// todo!()
|
|
||||||
let dock = self.dock.read(cx);
|
let dock = self.dock.read(cx);
|
||||||
let active_index = dock.active_panel_index;
|
let active_index = dock.active_panel_index;
|
||||||
let is_open = dock.is_open;
|
let is_open = dock.is_open;
|
||||||
|
|
|
@ -8,8 +8,6 @@ use std::{any::TypeId, ops::DerefMut};
|
||||||
|
|
||||||
pub fn init(cx: &mut AppContext) {
|
pub fn init(cx: &mut AppContext) {
|
||||||
cx.set_global(NotificationTracker::new());
|
cx.set_global(NotificationTracker::new());
|
||||||
// todo!()
|
|
||||||
// simple_message_notification::init(cx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Notification: EventEmitter<DismissEvent> + Render {}
|
pub trait Notification: EventEmitter<DismissEvent> + Render {}
|
||||||
|
|
|
@ -242,87 +242,6 @@ pub struct DraggedTab {
|
||||||
pub is_active: bool,
|
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 EventEmitter<Event> for Pane {}
|
||||||
|
|
||||||
impl Pane {
|
impl Pane {
|
||||||
|
@ -333,13 +252,6 @@ impl Pane {
|
||||||
can_drop_predicate: Option<Arc<dyn Fn(&dyn Any, &mut WindowContext) -> bool + 'static>>,
|
can_drop_predicate: Option<Arc<dyn Fn(&dyn Any, &mut WindowContext) -> bool + 'static>>,
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) -> 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 focus_handle = cx.focus_handle();
|
||||||
|
|
||||||
let subscriptions = vec![
|
let subscriptions = vec![
|
||||||
|
@ -370,11 +282,6 @@ impl Pane {
|
||||||
split_item_menu: None,
|
split_item_menu: None,
|
||||||
tab_bar_scroll_handle: ScrollHandle::new(),
|
tab_bar_scroll_handle: ScrollHandle::new(),
|
||||||
drag_split_direction: None,
|
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,
|
workspace,
|
||||||
project,
|
project,
|
||||||
can_drop_predicate,
|
can_drop_predicate,
|
||||||
|
@ -450,7 +357,6 @@ impl Pane {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn has_focus(&self, cx: &WindowContext) -> bool {
|
pub fn has_focus(&self, cx: &WindowContext) -> bool {
|
||||||
// todo!(); // inline this manually
|
|
||||||
self.focus_handle.contains_focused(cx)
|
self.focus_handle.contains_focused(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ use serde::Deserialize;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use ui::{prelude::*, Button};
|
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 HORIZONTAL_MIN_SIZE: f32 = 80.;
|
||||||
const VERTICAL_MIN_SIZE: f32 = 100.;
|
const VERTICAL_MIN_SIZE: f32 = 100.;
|
||||||
|
|
||||||
|
@ -268,15 +268,6 @@ impl Member {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.into_any()
|
.into_any()
|
||||||
|
|
||||||
// let el = div()
|
|
||||||
// .flex()
|
|
||||||
// .flex_1()
|
|
||||||
// .gap_px()
|
|
||||||
// .w_full()
|
|
||||||
// .h_full()
|
|
||||||
// .bg(cx.theme().colors().editor)
|
|
||||||
// .children();
|
|
||||||
}
|
}
|
||||||
Member::Axis(axis) => axis
|
Member::Axis(axis) => axis
|
||||||
.render(
|
.render(
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use std::{any::Any, sync::Arc};
|
use std::{any::Any, sync::Arc};
|
||||||
|
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyView, AppContext, EventEmitter, Subscription, Task, View, ViewContext, WeakView,
|
AnyView, AnyWeakView, AppContext, EventEmitter, Subscription, Task, View, ViewContext,
|
||||||
WindowContext,
|
WeakView, WindowContext,
|
||||||
};
|
};
|
||||||
use project::search::SearchQuery;
|
use project::search::SearchQuery;
|
||||||
|
|
||||||
|
@ -127,7 +127,6 @@ pub trait SearchableItemHandle: ItemHandle {
|
||||||
) -> Option<usize>;
|
) -> Option<usize>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo!("here is where we need to use AnyWeakView");
|
|
||||||
impl<T: SearchableItem> SearchableItemHandle for View<T> {
|
impl<T: SearchableItem> SearchableItemHandle for View<T> {
|
||||||
fn downgrade(&self) -> Box<dyn WeakSearchableItemHandle> {
|
fn downgrade(&self) -> Box<dyn WeakSearchableItemHandle> {
|
||||||
Box::new(self.downgrade())
|
Box::new(self.downgrade())
|
||||||
|
@ -249,7 +248,7 @@ impl Eq for Box<dyn SearchableItemHandle> {}
|
||||||
pub trait WeakSearchableItemHandle: WeakItemHandle {
|
pub trait WeakSearchableItemHandle: WeakItemHandle {
|
||||||
fn upgrade(&self, cx: &AppContext) -> Option<Box<dyn SearchableItemHandle>>;
|
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> {
|
impl<T: SearchableItem> WeakSearchableItemHandle for WeakView<T> {
|
||||||
|
@ -257,9 +256,9 @@ impl<T: SearchableItem> WeakSearchableItemHandle for WeakView<T> {
|
||||||
Some(Box::new(self.upgrade()?))
|
Some(Box::new(self.upgrade()?))
|
||||||
}
|
}
|
||||||
|
|
||||||
// fn into_any(self) -> AnyView {
|
fn into_any(self) -> AnyWeakView {
|
||||||
// self.into_any()
|
self.into()
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PartialEq for Box<dyn WeakSearchableItemHandle> {
|
impl PartialEq for Box<dyn WeakSearchableItemHandle> {
|
||||||
|
|
|
@ -852,6 +852,10 @@ impl Workspace {
|
||||||
&self.right_dock
|
&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>) {
|
pub fn add_panel<T: Panel>(&mut self, panel: View<T>, cx: &mut ViewContext<Self>) {
|
||||||
let dock = match panel.position(cx) {
|
let dock = match panel.position(cx) {
|
||||||
DockPosition::Left => &self.left_dock,
|
DockPosition::Left => &self.left_dock,
|
||||||
|
@ -1143,7 +1147,6 @@ impl Workspace {
|
||||||
quitting: bool,
|
quitting: bool,
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) -> Task<Result<bool>> {
|
) -> Task<Result<bool>> {
|
||||||
//todo!(saveing)
|
|
||||||
let active_call = self.active_call().cloned();
|
let active_call = self.active_call().cloned();
|
||||||
let window = cx.window_handle();
|
let window = cx.window_handle();
|
||||||
|
|
||||||
|
@ -1694,28 +1697,6 @@ impl Workspace {
|
||||||
None
|
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(
|
fn dismiss_zoomed_items_to_reveal(
|
||||||
&mut self,
|
&mut self,
|
||||||
dock_to_reveal: Option<DockPosition>,
|
dock_to_reveal: Option<DockPosition>,
|
||||||
|
@ -2078,7 +2059,7 @@ impl Workspace {
|
||||||
_ => bounding_box.center(),
|
_ => 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 {
|
let target = match direction {
|
||||||
SplitDirection::Left => {
|
SplitDirection::Left => {
|
||||||
|
|
|
@ -23,7 +23,7 @@ use quick_action_bar::QuickActionBar;
|
||||||
use search::project_search::ProjectSearchBar;
|
use search::project_search::ProjectSearchBar;
|
||||||
use settings::{initial_local_settings_content, KeymapFile, Settings, SettingsStore};
|
use settings::{initial_local_settings_content, KeymapFile, Settings, SettingsStore};
|
||||||
use std::{borrow::Cow, ops::Deref, sync::Arc};
|
use std::{borrow::Cow, ops::Deref, sync::Arc};
|
||||||
use terminal_view::terminal_panel::TerminalPanel;
|
use terminal_view::terminal_panel::{self, TerminalPanel};
|
||||||
use util::{
|
use util::{
|
||||||
asset_str,
|
asset_str,
|
||||||
channel::{AppCommitSha, ReleaseChannel},
|
channel::{AppCommitSha, ReleaseChannel},
|
||||||
|
@ -299,79 +299,42 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
//todo!()
|
.register_action(
|
||||||
// cx.add_action({
|
|workspace: &mut Workspace,
|
||||||
// move |workspace: &mut Workspace, _: &DebugElements, cx: &mut ViewContext<Workspace>| {
|
_: &project_panel::ToggleFocus,
|
||||||
// let app_state = workspace.app_state().clone();
|
cx: &mut ViewContext<Workspace>| {
|
||||||
// let markdown = app_state.languages.language_for_name("JSON");
|
workspace.toggle_panel_focus::<ProjectPanel>(cx);
|
||||||
// let window = cx.window();
|
},
|
||||||
// cx.spawn(|workspace, mut cx| async move {
|
)
|
||||||
// let markdown = markdown.await.log_err();
|
.register_action(
|
||||||
// let content = to_string_pretty(&window.debug_elements(&cx).ok_or_else(|| {
|
|workspace: &mut Workspace,
|
||||||
// anyhow!("could not debug elements for window {}", window.id())
|
_: &collab_ui::collab_panel::ToggleFocus,
|
||||||
// })?)
|
cx: &mut ViewContext<Workspace>| {
|
||||||
// .unwrap();
|
workspace.toggle_panel_focus::<collab_ui::collab_panel::CollabPanel>(cx);
|
||||||
// workspace
|
},
|
||||||
// .update(&mut cx, |workspace, cx| {
|
)
|
||||||
// workspace.with_local_workspace(cx, move |workspace, cx| {
|
.register_action(
|
||||||
// let project = workspace.project().clone();
|
|workspace: &mut Workspace,
|
||||||
// let buffer = project
|
_: &collab_ui::chat_panel::ToggleFocus,
|
||||||
// .update(cx, |project, cx| {
|
cx: &mut ViewContext<Workspace>| {
|
||||||
// project.create_buffer(&content, markdown, cx)
|
workspace.toggle_panel_focus::<collab_ui::chat_panel::ChatPanel>(cx);
|
||||||
// })
|
},
|
||||||
// .expect("creating buffers on a local workspace always succeeds");
|
)
|
||||||
// let buffer = cx.add_model(|cx| {
|
.register_action(
|
||||||
// MultiBuffer::singleton(buffer, cx)
|
|workspace: &mut Workspace,
|
||||||
// .with_title("Debug Elements".into())
|
_: &collab_ui::notification_panel::ToggleFocus,
|
||||||
// });
|
cx: &mut ViewContext<Workspace>| {
|
||||||
// workspace.add_item(
|
workspace
|
||||||
// Box::new(cx.add_view(|cx| {
|
.toggle_panel_focus::<collab_ui::notification_panel::NotificationPanel>(cx);
|
||||||
// Editor::for_multibuffer(buffer, Some(project.clone()), cx)
|
},
|
||||||
// })),
|
)
|
||||||
// cx,
|
.register_action(
|
||||||
// );
|
|workspace: &mut Workspace,
|
||||||
// })
|
_: &terminal_panel::ToggleFocus,
|
||||||
// })?
|
cx: &mut ViewContext<Workspace>| {
|
||||||
// .await
|
workspace.toggle_panel_focus::<TerminalPanel>(cx);
|
||||||
// })
|
},
|
||||||
// .detach_and_log_err(cx);
|
)
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// .register_action(
|
|
||||||
// |workspace: &mut Workspace,
|
|
||||||
// _: &project_panel::ToggleFocus,
|
|
||||||
// cx: &mut ViewContext<Workspace>| {
|
|
||||||
// workspace.toggle_panel_focus::<ProjectPanel>(cx);
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// cx.add_action(
|
|
||||||
// |workspace: &mut Workspace,
|
|
||||||
// _: &collab_ui::collab_panel::ToggleFocus,
|
|
||||||
// cx: &mut ViewContext<Workspace>| {
|
|
||||||
// workspace.toggle_panel_focus::<collab_ui::collab_panel::CollabPanel>(cx);
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// cx.add_action(
|
|
||||||
// |workspace: &mut Workspace,
|
|
||||||
// _: &collab_ui::chat_panel::ToggleFocus,
|
|
||||||
// cx: &mut ViewContext<Workspace>| {
|
|
||||||
// workspace.toggle_panel_focus::<collab_ui::chat_panel::ChatPanel>(cx);
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// cx.add_action(
|
|
||||||
// |workspace: &mut Workspace,
|
|
||||||
// _: &collab_ui::notification_panel::ToggleFocus,
|
|
||||||
// cx: &mut ViewContext<Workspace>| {
|
|
||||||
// workspace.toggle_panel_focus::<collab_ui::notification_panel::NotificationPanel>(cx);
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// cx.add_action(
|
|
||||||
// |workspace: &mut Workspace,
|
|
||||||
// _: &terminal_panel::ToggleFocus,
|
|
||||||
// cx: &mut ViewContext<Workspace>| {
|
|
||||||
// workspace.toggle_panel_focus::<TerminalPanel>(cx);
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
.register_action({
|
.register_action({
|
||||||
let app_state = Arc::downgrade(&app_state);
|
let app_state = Arc::downgrade(&app_state);
|
||||||
move |_, _: &NewWindow, cx| {
|
move |_, _: &NewWindow, cx| {
|
||||||
|
@ -1658,8 +1621,8 @@ mod tests {
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
save_task.await.unwrap();
|
save_task.await.unwrap();
|
||||||
// todo!() po
|
|
||||||
//assert!(!cx.did_prompt_for_new_path());
|
assert!(!cx.did_prompt_for_new_path());
|
||||||
window
|
window
|
||||||
.update(cx, |_, cx| {
|
.update(cx, |_, cx| {
|
||||||
editor.update(cx, |editor, cx| {
|
editor.update(cx, |editor, cx| {
|
||||||
|
|
|
@ -132,7 +132,7 @@ else
|
||||||
cp -R target/${target_dir}/WebRTC.framework "${app_path}/Contents/Frameworks/"
|
cp -R target/${target_dir}/WebRTC.framework "${app_path}/Contents/Frameworks/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#todo!(The app identifier has been set to 'Dev', but the channel is nightly, RATIONALIZE ALL OF THIS MESS)
|
# Note: The app identifier for our development builds is the same as the app identifier for nightly.
|
||||||
cp crates/${zed_crate}/contents/$channel/embedded.provisionprofile "${app_path}/Contents/"
|
cp crates/${zed_crate}/contents/$channel/embedded.provisionprofile "${app_path}/Contents/"
|
||||||
|
|
||||||
if [[ -n $MACOS_CERTIFICATE && -n $MACOS_CERTIFICATE_PASSWORD && -n $APPLE_NOTARIZATION_USERNAME && -n $APPLE_NOTARIZATION_PASSWORD ]]; then
|
if [[ -n $MACOS_CERTIFICATE && -n $MACOS_CERTIFICATE_PASSWORD && -n $APPLE_NOTARIZATION_USERNAME && -n $APPLE_NOTARIZATION_PASSWORD ]]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue