WIP: remoting (#10085)

Release Notes:

- Added private alpha support for remote development. Please reach out to hi@zed.dev if you'd like to be part of shaping this feature.
This commit is contained in:
Conrad Irwin 2024-04-11 15:36:35 -06:00 committed by GitHub
parent ea4419076e
commit f6c85b28d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 4117 additions and 759 deletions

View file

@ -1,3 +1,4 @@
pub mod connection_manager;
pub mod debounced_delay;
pub mod lsp_command;
pub mod lsp_ext_command;
@ -234,6 +235,7 @@ enum BufferOrderedMessage {
Resync,
}
#[derive(Debug)]
enum LocalProjectUpdate {
WorktreesChanged,
CreateBufferForPeer {
@ -597,6 +599,7 @@ impl Project {
}
pub fn init(client: &Arc<Client>, cx: &mut AppContext) {
connection_manager::init(client.clone(), cx);
Self::init_settings(cx);
client.add_model_message_handler(Self::handle_add_collaborator);
@ -733,6 +736,24 @@ impl Project {
languages: Arc<LanguageRegistry>,
fs: Arc<dyn Fs>,
cx: AsyncAppContext,
) -> Result<Model<Self>> {
let project =
Self::in_room(remote_id, client, user_store, languages, fs, cx.clone()).await?;
cx.update(|cx| {
connection_manager::Manager::global(cx).update(cx, |manager, cx| {
manager.maintain_project_connection(&project, cx)
})
})?;
Ok(project)
}
pub async fn in_room(
remote_id: u64,
client: Arc<Client>,
user_store: Model<UserStore>,
languages: Arc<LanguageRegistry>,
fs: Arc<dyn Fs>,
cx: AsyncAppContext,
) -> Result<Model<Self>> {
client.authenticate_and_connect(true, &cx).await?;
@ -753,6 +774,7 @@ impl Project {
)
.await
}
async fn from_join_project_response(
response: TypedEnvelope<proto::JoinProjectResponse>,
subscription: PendingEntitySubscription<Project>,
@ -1561,7 +1583,7 @@ impl Project {
})
})?
.await;
if update_project.is_ok() {
if update_project.log_err().is_some() {
for worktree in worktrees {
worktree.update(&mut cx, |worktree, cx| {
let worktree = worktree.as_local_mut().unwrap();