Reoganize remote client code to make room for non-ssh remote projects
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
parent
84c243576f
commit
e0223add54
35 changed files with 1596 additions and 1579 deletions
|
@ -21,7 +21,7 @@ use project::{
|
|||
};
|
||||
use rpc::{
|
||||
AnyProtoClient, TypedEnvelope,
|
||||
proto::{self, SSH_PEER_ID, SSH_PROJECT_ID},
|
||||
proto::{self, REMOTE_SERVER_PEER_ID, REMOTE_SERVER_PROJECT_ID},
|
||||
};
|
||||
|
||||
use settings::initial_server_settings_content;
|
||||
|
@ -83,7 +83,7 @@ impl HeadlessProject {
|
|||
|
||||
let worktree_store = cx.new(|cx| {
|
||||
let mut store = WorktreeStore::local(true, fs.clone());
|
||||
store.shared(SSH_PROJECT_ID, session.clone(), cx);
|
||||
store.shared(REMOTE_SERVER_PROJECT_ID, session.clone(), cx);
|
||||
store
|
||||
});
|
||||
|
||||
|
@ -101,7 +101,7 @@ impl HeadlessProject {
|
|||
|
||||
let buffer_store = cx.new(|cx| {
|
||||
let mut buffer_store = BufferStore::local(worktree_store.clone(), cx);
|
||||
buffer_store.shared(SSH_PROJECT_ID, session.clone(), cx);
|
||||
buffer_store.shared(REMOTE_SERVER_PROJECT_ID, session.clone(), cx);
|
||||
buffer_store
|
||||
});
|
||||
|
||||
|
@ -119,7 +119,7 @@ impl HeadlessProject {
|
|||
breakpoint_store.clone(),
|
||||
cx,
|
||||
);
|
||||
dap_store.shared(SSH_PROJECT_ID, session.clone(), cx);
|
||||
dap_store.shared(REMOTE_SERVER_PROJECT_ID, session.clone(), cx);
|
||||
dap_store
|
||||
});
|
||||
|
||||
|
@ -131,7 +131,7 @@ impl HeadlessProject {
|
|||
fs.clone(),
|
||||
cx,
|
||||
);
|
||||
store.shared(SSH_PROJECT_ID, session.clone(), cx);
|
||||
store.shared(REMOTE_SERVER_PROJECT_ID, session.clone(), cx);
|
||||
store
|
||||
});
|
||||
|
||||
|
@ -154,7 +154,7 @@ impl HeadlessProject {
|
|||
environment.clone(),
|
||||
cx,
|
||||
);
|
||||
task_store.shared(SSH_PROJECT_ID, session.clone(), cx);
|
||||
task_store.shared(REMOTE_SERVER_PROJECT_ID, session.clone(), cx);
|
||||
task_store
|
||||
});
|
||||
let settings_observer = cx.new(|cx| {
|
||||
|
@ -164,7 +164,7 @@ impl HeadlessProject {
|
|||
task_store.clone(),
|
||||
cx,
|
||||
);
|
||||
observer.shared(SSH_PROJECT_ID, session.clone(), cx);
|
||||
observer.shared(REMOTE_SERVER_PROJECT_ID, session.clone(), cx);
|
||||
observer
|
||||
});
|
||||
|
||||
|
@ -185,7 +185,7 @@ impl HeadlessProject {
|
|||
fs.clone(),
|
||||
cx,
|
||||
);
|
||||
lsp_store.shared(SSH_PROJECT_ID, session.clone(), cx);
|
||||
lsp_store.shared(REMOTE_SERVER_PROJECT_ID, session.clone(), cx);
|
||||
lsp_store
|
||||
});
|
||||
|
||||
|
@ -213,15 +213,15 @@ impl HeadlessProject {
|
|||
);
|
||||
|
||||
// local_machine -> ssh handlers
|
||||
session.subscribe_to_entity(SSH_PROJECT_ID, &worktree_store);
|
||||
session.subscribe_to_entity(SSH_PROJECT_ID, &buffer_store);
|
||||
session.subscribe_to_entity(SSH_PROJECT_ID, &cx.entity());
|
||||
session.subscribe_to_entity(SSH_PROJECT_ID, &lsp_store);
|
||||
session.subscribe_to_entity(SSH_PROJECT_ID, &task_store);
|
||||
session.subscribe_to_entity(SSH_PROJECT_ID, &toolchain_store);
|
||||
session.subscribe_to_entity(SSH_PROJECT_ID, &dap_store);
|
||||
session.subscribe_to_entity(SSH_PROJECT_ID, &settings_observer);
|
||||
session.subscribe_to_entity(SSH_PROJECT_ID, &git_store);
|
||||
session.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &worktree_store);
|
||||
session.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &buffer_store);
|
||||
session.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &cx.entity());
|
||||
session.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &lsp_store);
|
||||
session.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &task_store);
|
||||
session.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &toolchain_store);
|
||||
session.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &dap_store);
|
||||
session.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &settings_observer);
|
||||
session.subscribe_to_entity(REMOTE_SERVER_PROJECT_ID, &git_store);
|
||||
|
||||
session.add_request_handler(cx.weak_entity(), Self::handle_list_remote_directory);
|
||||
session.add_request_handler(cx.weak_entity(), Self::handle_get_path_metadata);
|
||||
|
@ -288,7 +288,7 @@ impl HeadlessProject {
|
|||
} = event
|
||||
{
|
||||
cx.background_spawn(self.session.request(proto::UpdateBuffer {
|
||||
project_id: SSH_PROJECT_ID,
|
||||
project_id: REMOTE_SERVER_PROJECT_ID,
|
||||
buffer_id: buffer.read(cx).remote_id().to_proto(),
|
||||
operations: vec![serialize_operation(operation)],
|
||||
}))
|
||||
|
@ -310,7 +310,7 @@ impl HeadlessProject {
|
|||
} => {
|
||||
self.session
|
||||
.send(proto::UpdateLanguageServer {
|
||||
project_id: SSH_PROJECT_ID,
|
||||
project_id: REMOTE_SERVER_PROJECT_ID,
|
||||
server_name: name.as_ref().map(|name| name.to_string()),
|
||||
language_server_id: language_server_id.to_proto(),
|
||||
variant: Some(message.clone()),
|
||||
|
@ -320,7 +320,7 @@ impl HeadlessProject {
|
|||
LspStoreEvent::Notification(message) => {
|
||||
self.session
|
||||
.send(proto::Toast {
|
||||
project_id: SSH_PROJECT_ID,
|
||||
project_id: REMOTE_SERVER_PROJECT_ID,
|
||||
notification_id: "lsp".to_string(),
|
||||
message: message.clone(),
|
||||
})
|
||||
|
@ -329,7 +329,7 @@ impl HeadlessProject {
|
|||
LspStoreEvent::LanguageServerLog(language_server_id, log_type, message) => {
|
||||
self.session
|
||||
.send(proto::LanguageServerLog {
|
||||
project_id: SSH_PROJECT_ID,
|
||||
project_id: REMOTE_SERVER_PROJECT_ID,
|
||||
language_server_id: language_server_id.to_proto(),
|
||||
message: message.clone(),
|
||||
log_type: Some(log_type.to_proto()),
|
||||
|
@ -338,7 +338,7 @@ impl HeadlessProject {
|
|||
}
|
||||
LspStoreEvent::LanguageServerPrompt(prompt) => {
|
||||
let request = self.session.request(proto::LanguageServerPromptRequest {
|
||||
project_id: SSH_PROJECT_ID,
|
||||
project_id: REMOTE_SERVER_PROJECT_ID,
|
||||
actions: prompt
|
||||
.actions
|
||||
.iter()
|
||||
|
@ -474,7 +474,7 @@ impl HeadlessProject {
|
|||
let buffer_id = buffer.read_with(&cx, |b, _| b.remote_id())?;
|
||||
buffer_store.update(&mut cx, |buffer_store, cx| {
|
||||
buffer_store
|
||||
.create_buffer_for_peer(&buffer, SSH_PEER_ID, cx)
|
||||
.create_buffer_for_peer(&buffer, REMOTE_SERVER_PEER_ID, cx)
|
||||
.detach_and_log_err(cx);
|
||||
})?;
|
||||
|
||||
|
@ -500,7 +500,7 @@ impl HeadlessProject {
|
|||
let buffer_id = buffer.read_with(&cx, |b, _| b.remote_id())?;
|
||||
buffer_store.update(&mut cx, |buffer_store, cx| {
|
||||
buffer_store
|
||||
.create_buffer_for_peer(&buffer, SSH_PEER_ID, cx)
|
||||
.create_buffer_for_peer(&buffer, REMOTE_SERVER_PEER_ID, cx)
|
||||
.detach_and_log_err(cx);
|
||||
})?;
|
||||
|
||||
|
@ -550,7 +550,7 @@ impl HeadlessProject {
|
|||
|
||||
buffer_store.update(cx, |buffer_store, cx| {
|
||||
buffer_store
|
||||
.create_buffer_for_peer(&buffer, SSH_PEER_ID, cx)
|
||||
.create_buffer_for_peer(&buffer, REMOTE_SERVER_PEER_ID, cx)
|
||||
.detach_and_log_err(cx);
|
||||
});
|
||||
|
||||
|
@ -586,7 +586,7 @@ impl HeadlessProject {
|
|||
response.buffer_ids.push(buffer_id.to_proto());
|
||||
buffer_store
|
||||
.update(&mut cx, |buffer_store, cx| {
|
||||
buffer_store.create_buffer_for_peer(&buffer, SSH_PEER_ID, cx)
|
||||
buffer_store.create_buffer_for_peer(&buffer, REMOTE_SERVER_PEER_ID, cx)
|
||||
})?
|
||||
.await?;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue