Merge pull request #1081 from zed-industries/project-panel-with-new-mouse-events

Introduce context menu to project panel
This commit is contained in:
Antonio Scandurra 2022-05-31 10:40:42 +02:00 committed by GitHub
commit da46d78ea5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 2493 additions and 673 deletions

View file

@ -656,6 +656,9 @@ async fn test_fs_operations(
cx_b: &mut TestAppContext,
) {
executor.forbid_parking();
let fs = FakeFs::new(cx_a.background());
// Connect to a server as 2 clients.
let mut server = TestServer::start(cx_a.foreground(), cx_a.background()).await;
let mut client_a = server.create_client(cx_a, "user_a").await;
let mut client_b = server.create_client(cx_b, "user_b").await;
@ -663,7 +666,7 @@ async fn test_fs_operations(
.make_contacts(vec![(&client_a, cx_a), (&client_b, cx_b)])
.await;
let fs = FakeFs::new(cx_a.background());
// Share a project as client A
fs.insert_tree(
"/dir",
json!({
@ -759,6 +762,110 @@ async fn test_fs_operations(
);
});
project_b
.update(cx_b, |project, cx| {
project
.create_entry((worktree_id, "DIR/e.txt"), false, cx)
.unwrap()
})
.await
.unwrap();
project_b
.update(cx_b, |project, cx| {
project
.create_entry((worktree_id, "DIR/SUBDIR"), true, cx)
.unwrap()
})
.await
.unwrap();
project_b
.update(cx_b, |project, cx| {
project
.create_entry((worktree_id, "DIR/SUBDIR/f.txt"), false, cx)
.unwrap()
})
.await
.unwrap();
worktree_a.read_with(cx_a, |worktree, _| {
assert_eq!(
worktree
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
[
"DIR",
"DIR/SUBDIR",
"DIR/SUBDIR/f.txt",
"DIR/e.txt",
"a.txt",
"b.txt",
"d.txt"
]
);
});
worktree_b.read_with(cx_b, |worktree, _| {
assert_eq!(
worktree
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
[
"DIR",
"DIR/SUBDIR",
"DIR/SUBDIR/f.txt",
"DIR/e.txt",
"a.txt",
"b.txt",
"d.txt"
]
);
});
project_b
.update(cx_b, |project, cx| {
project
.copy_entry(entry.id, Path::new("f.txt"), cx)
.unwrap()
})
.await
.unwrap();
worktree_a.read_with(cx_a, |worktree, _| {
assert_eq!(
worktree
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
[
"DIR",
"DIR/SUBDIR",
"DIR/SUBDIR/f.txt",
"DIR/e.txt",
"a.txt",
"b.txt",
"d.txt",
"f.txt"
]
);
});
worktree_b.read_with(cx_b, |worktree, _| {
assert_eq!(
worktree
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
[
"DIR",
"DIR/SUBDIR",
"DIR/SUBDIR/f.txt",
"DIR/e.txt",
"a.txt",
"b.txt",
"d.txt",
"f.txt"
]
);
});
project_b
.update(cx_b, |project, cx| {
project.delete_entry(dir_entry.id, cx).unwrap()
@ -771,7 +878,7 @@ async fn test_fs_operations(
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
["a.txt", "b.txt", "d.txt"]
["a.txt", "b.txt", "d.txt", "f.txt"]
);
});
worktree_b.read_with(cx_b, |worktree, _| {
@ -780,7 +887,7 @@ async fn test_fs_operations(
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
["a.txt", "b.txt", "d.txt"]
["a.txt", "b.txt", "d.txt", "f.txt"]
);
});
@ -796,7 +903,7 @@ async fn test_fs_operations(
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
["a.txt", "b.txt"]
["a.txt", "b.txt", "f.txt"]
);
});
worktree_b.read_with(cx_b, |worktree, _| {
@ -805,7 +912,7 @@ async fn test_fs_operations(
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
["a.txt", "b.txt"]
["a.txt", "b.txt", "f.txt"]
);
});
}

View file

@ -82,6 +82,7 @@ pub fn init_tracing(config: &Config) -> Option<()> {
use tracing_subscriber::layer::SubscriberExt;
let rust_log = config.rust_log.clone()?;
println!("HEY!");
LogTracer::init().log_err()?;
let subscriber = tracing_subscriber::Registry::default()

View file

@ -171,6 +171,7 @@ impl Server {
.add_request_handler(Server::forward_project_request::<proto::FormatBuffers>)
.add_request_handler(Server::forward_project_request::<proto::CreateProjectEntry>)
.add_request_handler(Server::forward_project_request::<proto::RenameProjectEntry>)
.add_request_handler(Server::forward_project_request::<proto::CopyProjectEntry>)
.add_request_handler(Server::forward_project_request::<proto::DeleteProjectEntry>)
.add_request_handler(Server::update_buffer)
.add_message_handler(Server::update_buffer_file)