Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Merge branch 'main' into collab-panel

Max Brunsfeldc537cf2a5722
diff --cc crates/collab/src/tests.rs
index a8e2a129628,4804f5b0f1f..f4b5e2249d3
--- a/crates/collab/src/tests.rs
+++ b/crates/collab/src/tests.rs
@@@ -570,10 -495,9 +570,11 @@@ impl TestClient
// We use a workspace container so that we don't need to remove the window in order to
// drop the workspace and we can use a ViewHandle instead.
- let (window_id, container) = cx.add_window(|_| WorkspaceContainer { workspace: None });
- let workspace = cx.add_view(window_id, |cx| {
+ let window = cx.add_window(|_| WorkspaceContainer { workspace: None });
+ let container = window.root(cx);
- let workspace = window.add_view(cx, |cx| Workspace::test_new(project.clone(), cx));
++ let workspace = window.add_view(cx, |cx| {
+ Workspace::new(0, project.clone(), self.app_state.clone(), cx)
+ });
container.update(cx, |container, cx| {
container.workspace = Some(workspace.downgrade());
cx.notify();
diff --cc crates/collab/src/tests/integration_tests.rs
index 93ebb812ad5,037f97f71ab..6c66677a739
--- a/crates/collab/src/tests/integration_tests.rs
+++ b/crates/collab/src/tests/integration_tests.rs
@@@ -1499,8 -1498,8 +1498,9 @@@ async fn test_host_disconnect
deterministic.run_until_parked();
assert!(worktree_a.read_with(cx_a, |tree, _| tree.as_local().unwrap().is_shared()));
- let (window_id_b, workspace_b) =
- let window_b = cx_b.add_window(|cx| Workspace::test_new(project_b.clone(), cx));
++ let window_b =
+ cx_b.add_window(|cx| Workspace::new(0, project_b.clone(), client_b.app_state.clone(), cx));
+ let workspace_b = window_b.root(cx_b);
let editor_b = workspace_b
.update(cx_b, |workspace, cx| {
workspace.open_path((worktree_id, "b.txt"), None, true, cx)
@@@ -5312,8 -5309,8 +5306,9 @@@ async fn test_collaborating_with_code_a
// Join the project as client B.
let project_b = client_b.build_remote_project(project_id, cx_b).await;
- let (_window_b, workspace_b) =
- let window_b = cx_b.add_window(|cx| Workspace::test_new(project_b.clone(), cx));
++ let window_b =
+ cx_b.add_window(|cx| Workspace::new(0, project_b.clone(), client_b.app_state.clone(), cx));
+ let workspace_b = window_b.root(cx_b);
let editor_b = workspace_b
.update(cx_b, |workspace, cx| {
workspace.open_path((worktree_id, "main.rs"), None, true, cx)
@@@ -5537,8 -5534,8 +5532,9 @@@ async fn test_collaborating_with_rename
.unwrap();
let project_b = client_b.build_remote_project(project_id, cx_b).await;
- let (_window_b, workspace_b) =
- let window_b = cx_b.add_window(|cx| Workspace::test_new(project_b.clone(), cx));
++ let window_b =
+ cx_b.add_window(|cx| Workspace::new(0, project_b.clone(), client_b.app_state.clone(), cx));
+ let workspace_b = window_b.root(cx_b);
let editor_b = workspace_b
.update(cx_b, |workspace, cx| {
workspace.open_path((worktree_id, "one.rs"), None, true, cx)
diff --cc crates/workspace/src/dock.rs
index 3b0dc819201,ebaf399e22b..6c88e5032c0
--- a/crates/workspace/src/dock.rs
+++ b/crates/workspace/src/dock.rs
@@@ -20,27 -20,13 +20,23 @@@ pub trait Panel: View
None
}
fn should_change_position_on_event(_: &Self::Event) -> bool;
- fn should_zoom_in_on_event(_: &Self::Event) -> bool;
- fn should_zoom_out_on_event(_: &Self::Event) -> bool;
- fn is_zoomed(&self, cx: &WindowContext) -> bool;
- fn set_zoomed(&mut self, zoomed: bool, cx: &mut ViewContext<Self>);
- fn set_active(&mut self, active: bool, cx: &mut ViewContext<Self>);
- fn should_activate_on_event(_: &Self::Event) -> bool;
- fn should_close_on_event(_: &Self::Event) -> bool;
+ fn should_zoom_in_on_event(_: &Self::Event) -> bool {
+ false
+ }
+ fn should_zoom_out_on_event(_: &Self::Event) -> bool {
+ false
+ }
+ fn is_zoomed(&self, _cx: &WindowContext) -> bool {
+ false
+ }
- fn set_zoomed(&mut self, _zoomed: bool, _cx: &mut ViewContext<Self>) {
-
- }
- fn set_active(&mut self, _active: bool, _cx: &mut ViewContext<Self>) {
-
- }
++ fn set_zoomed(&mut self, _zoomed: bool, _cx: &mut ViewContext<Self>) {}
++ fn set_active(&mut self, _active: bool, _cx: &mut ViewContext<Self>) {}
+ fn should_activate_on_event(_: &Self::Event) -> bool {
+ false
+ }
+ fn should_close_on_event(_: &Self::Event) -> bool {
+ false
+ }
fn has_focus(&self, cx: &WindowContext) -> bool;
fn is_focus_event(_: &Self::Event) -> bool;
}