ssh remote: Handle disconnect on project and show overlay (#19014)

Demo:



https://github.com/user-attachments/assets/e5edf8f3-8c15-482e-a792-6eb619f83de4


Release Notes:

- N/A

---------

Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
Thorsten Ball 2024-10-10 12:59:09 +02:00 committed by GitHub
parent e3ff2ced79
commit b75532fad7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 264 additions and 78 deletions

View file

@ -647,17 +647,10 @@ pub struct FormattableBuffer {
}
pub struct RemoteLspStore {
upstream_client: AnyProtoClient,
upstream_client: Option<AnyProtoClient>,
upstream_project_id: u64,
}
impl RemoteLspStore {}
// pub struct SshLspStore {
// upstream_client: AnyProtoClient,
// current_lsp_settings: HashMap<LanguageServerName, LspSettings>,
// }
#[allow(clippy::large_enum_variant)]
pub enum LspStoreMode {
Local(LocalLspStore), // ssh host and collab host
@ -808,10 +801,15 @@ impl LspStore {
pub fn upstream_client(&self) -> Option<(AnyProtoClient, u64)> {
match &self.mode {
LspStoreMode::Remote(RemoteLspStore {
upstream_client,
upstream_client: Some(upstream_client),
upstream_project_id,
..
}) => Some((upstream_client.clone(), *upstream_project_id)),
LspStoreMode::Remote(RemoteLspStore {
upstream_client: None,
..
}) => None,
LspStoreMode::Local(_) => None,
}
}
@ -924,7 +922,7 @@ impl LspStore {
Self {
mode: LspStoreMode::Remote(RemoteLspStore {
upstream_client,
upstream_client: Some(upstream_client),
upstream_project_id: project_id,
}),
downstream_client: None,
@ -3099,6 +3097,15 @@ impl LspStore {
self.downstream_client.take();
}
pub fn disconnected_from_ssh_remote(&mut self) {
if let LspStoreMode::Remote(RemoteLspStore {
upstream_client, ..
}) = &mut self.mode
{
upstream_client.take();
}
}
pub(crate) fn set_language_server_statuses_from_proto(
&mut self,
language_servers: Vec<proto::LanguageServer>,