collab: Fix project sharing between Windows and Unix (#23680)

Closes #14258

Windows user(host) sharing a project to a guest(using macOS), and host
follows guest:


https://github.com/user-attachments/assets/ba306b6b-23f7-48b1-8ba8-fdc5992d8f00

macOS user(host) sharing a project to a guest(using Windows), and host
follows guest:



https://github.com/user-attachments/assets/c5ee5e78-870d-49e5-907d-8565977a01ae

macOS user edits files in a windows project through collab:



https://github.com/user-attachments/assets/581057cf-e7df-4e56-a0ce-ced74339906a





Release Notes:

- N/A
This commit is contained in:
张小白 2025-02-11 08:12:01 +08:00 committed by GitHub
parent 929c5e76b4
commit c1f162abc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 226 additions and 117 deletions

View file

@ -859,7 +859,7 @@ async fn test_remote_resolve_path_in_buffer(
async fn test_remote_resolve_abs_path(cx: &mut TestAppContext, server_cx: &mut TestAppContext) {
let fs = FakeFs::new(server_cx.executor());
fs.insert_tree(
"/code",
path!("/code"),
json!({
"project1": {
".git": {},
@ -876,7 +876,7 @@ async fn test_remote_resolve_abs_path(cx: &mut TestAppContext, server_cx: &mut T
let path = project
.update(cx, |project, cx| {
project.resolve_abs_path("/code/project1/README.md", cx)
project.resolve_abs_path(path!("/code/project1/README.md"), cx)
})
.await
.unwrap();
@ -884,12 +884,12 @@ async fn test_remote_resolve_abs_path(cx: &mut TestAppContext, server_cx: &mut T
assert!(path.is_file());
assert_eq!(
path.abs_path().unwrap().to_string_lossy(),
"/code/project1/README.md"
path!("/code/project1/README.md")
);
let path = project
.update(cx, |project, cx| {
project.resolve_abs_path("/code/project1/src", cx)
project.resolve_abs_path(path!("/code/project1/src"), cx)
})
.await
.unwrap();
@ -897,12 +897,12 @@ async fn test_remote_resolve_abs_path(cx: &mut TestAppContext, server_cx: &mut T
assert!(path.is_dir());
assert_eq!(
path.abs_path().unwrap().to_string_lossy(),
"/code/project1/src"
path!("/code/project1/src")
);
let path = project
.update(cx, |project, cx| {
project.resolve_abs_path("/code/project1/DOESNOTEXIST", cx)
project.resolve_abs_path(path!("/code/project1/DOESNOTEXIST"), cx)
})
.await;
assert!(path.is_none());
@ -958,7 +958,7 @@ async fn test_adding_then_removing_then_adding_worktrees(
) {
let fs = FakeFs::new(server_cx.executor());
fs.insert_tree(
"/code",
path!("/code"),
json!({
"project1": {
".git": {},
@ -977,14 +977,14 @@ async fn test_adding_then_removing_then_adding_worktrees(
let (project, _headless) = init_test(&fs, cx, server_cx).await;
let (_worktree, _) = project
.update(cx, |project, cx| {
project.find_or_create_worktree("/code/project1", true, cx)
project.find_or_create_worktree(path!("/code/project1"), true, cx)
})
.await
.unwrap();
let (worktree_2, _) = project
.update(cx, |project, cx| {
project.find_or_create_worktree("/code/project2", true, cx)
project.find_or_create_worktree(path!("/code/project2"), true, cx)
})
.await
.unwrap();
@ -994,7 +994,7 @@ async fn test_adding_then_removing_then_adding_worktrees(
let (worktree_2, _) = project
.update(cx, |project, cx| {
project.find_or_create_worktree("/code/project2", true, cx)
project.find_or_create_worktree(path!("/code/project2"), true, cx)
})
.await
.unwrap();