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:
parent
929c5e76b4
commit
c1f162abc6
14 changed files with 226 additions and 117 deletions
|
@ -73,7 +73,7 @@ pub use prettier_store::PrettierStore;
|
|||
use project_settings::{ProjectSettings, SettingsObserver, SettingsObserverEvent};
|
||||
use remote::{SshConnectionOptions, SshRemoteClient};
|
||||
use rpc::{
|
||||
proto::{LanguageServerPromptResponse, SSH_PROJECT_ID},
|
||||
proto::{FromProto, LanguageServerPromptResponse, ToProto, SSH_PROJECT_ID},
|
||||
AnyProtoClient, ErrorCode,
|
||||
};
|
||||
use search::{SearchInputKind, SearchQuery, SearchResult};
|
||||
|
@ -297,14 +297,14 @@ impl ProjectPath {
|
|||
pub fn from_proto(p: proto::ProjectPath) -> Self {
|
||||
Self {
|
||||
worktree_id: WorktreeId::from_proto(p.worktree_id),
|
||||
path: Arc::from(PathBuf::from(p.path)),
|
||||
path: Arc::<Path>::from_proto(p.path),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_proto(&self) -> proto::ProjectPath {
|
||||
proto::ProjectPath {
|
||||
worktree_id: self.worktree_id.to_proto(),
|
||||
path: self.path.to_string_lossy().to_string(),
|
||||
path: self.path.as_ref().to_proto(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3360,18 +3360,19 @@ impl Project {
|
|||
})
|
||||
})
|
||||
} else if let Some(ssh_client) = self.ssh_client.as_ref() {
|
||||
let request_path = Path::new(path);
|
||||
let request = ssh_client
|
||||
.read(cx)
|
||||
.proto_client()
|
||||
.request(proto::GetPathMetadata {
|
||||
project_id: SSH_PROJECT_ID,
|
||||
path: path.to_string(),
|
||||
path: request_path.to_proto(),
|
||||
});
|
||||
cx.background_executor().spawn(async move {
|
||||
let response = request.await.log_err()?;
|
||||
if response.exists {
|
||||
Some(ResolvedPath::AbsPath {
|
||||
path: PathBuf::from(response.path),
|
||||
path: PathBuf::from_proto(response.path),
|
||||
is_dir: response.is_dir,
|
||||
})
|
||||
} else {
|
||||
|
@ -3441,9 +3442,10 @@ impl Project {
|
|||
if self.is_local() {
|
||||
DirectoryLister::Local(self.fs.clone()).list_directory(query, cx)
|
||||
} else if let Some(session) = self.ssh_client.as_ref() {
|
||||
let path_buf = PathBuf::from(query);
|
||||
let request = proto::ListRemoteDirectory {
|
||||
dev_server_id: SSH_PROJECT_ID,
|
||||
path: query,
|
||||
path: path_buf.to_proto(),
|
||||
};
|
||||
|
||||
let response = session.read(cx).proto_client().request(request);
|
||||
|
@ -3994,7 +3996,7 @@ impl Project {
|
|||
this.open_buffer(
|
||||
ProjectPath {
|
||||
worktree_id,
|
||||
path: PathBuf::from(envelope.payload.path).into(),
|
||||
path: Arc::<Path>::from_proto(envelope.payload.path),
|
||||
},
|
||||
cx,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue