Fix remoting things (#19587)

- Fixes modal closing when using the remote modal folder 
- Fixes a bug with local terminals where they could open in / instead of
~
- Fixes a bug where SSH connections would continue running after their
window is closed
- Hides SSH Terminal process details from Zed UI
- Implement `cmd-o` for remote projects
- Implement LanguageServerPromptRequest for remote LSPs

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2024-10-23 00:14:43 -07:00 committed by GitHub
parent fabc14355c
commit d0bc84eb33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 318 additions and 109 deletions

View file

@ -1,6 +1,6 @@
use anyhow::{anyhow, Result};
use fs::Fs;
use gpui::{AppContext, AsyncAppContext, Context, Model, ModelContext};
use gpui::{AppContext, AsyncAppContext, Context, Model, ModelContext, PromptLevel};
use http_client::HttpClient;
use language::{proto::serialize_operation, Buffer, BufferEvent, LanguageRegistry};
use node_runtime::NodeRuntime;
@ -206,7 +206,7 @@ impl HeadlessProject {
&mut self,
_lsp_store: Model<LspStore>,
event: &LspStoreEvent,
_cx: &mut ModelContext<Self>,
cx: &mut ModelContext<Self>,
) {
match event {
LspStoreEvent::LanguageServerUpdate {
@ -240,6 +240,29 @@ impl HeadlessProject {
})
.log_err();
}
LspStoreEvent::LanguageServerPrompt(prompt) => {
let prompt = prompt.clone();
let request = self.session.request(proto::LanguageServerPromptRequest {
project_id: SSH_PROJECT_ID,
actions: prompt
.actions
.iter()
.map(|action| action.title.to_string())
.collect(),
level: Some(prompt_to_proto(&prompt)),
lsp_name: Default::default(),
message: Default::default(),
});
cx.background_executor()
.spawn(async move {
let response = request.await?;
if let Some(action_response) = response.action_response {
prompt.respond(action_response as usize).await;
}
anyhow::Ok(())
})
.detach();
}
_ => {}
}
}
@ -540,3 +563,19 @@ impl HeadlessProject {
Ok(proto::Ack {})
}
}
fn prompt_to_proto(
prompt: &project::LanguageServerPromptRequest,
) -> proto::language_server_prompt_request::Level {
match prompt.level {
PromptLevel::Info => proto::language_server_prompt_request::Level::Info(
proto::language_server_prompt_request::Info {},
),
PromptLevel::Warning => proto::language_server_prompt_request::Level::Warning(
proto::language_server_prompt_request::Warning {},
),
PromptLevel::Critical => proto::language_server_prompt_request::Level::Critical(
proto::language_server_prompt_request::Critical {},
),
}
}