SSH remote ui (#15129)

Still TODO:
* [x] hide this UI unless you have some ssh projects in settings
* [x] add the "open folder" flow with the new open picker
* [ ] integrate with recent projects / workspace restoration

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-07-26 16:45:44 -06:00 committed by GitHub
parent be86852f95
commit 3e31955b7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 1162 additions and 436 deletions

View file

@ -625,13 +625,13 @@ where
}
}
pub trait DetachAndPromptErr {
pub trait DetachAndPromptErr<R> {
fn prompt_err(
self,
msg: &str,
cx: &mut WindowContext,
f: impl FnOnce(&anyhow::Error, &mut WindowContext) -> Option<String> + 'static,
) -> Task<()>;
) -> Task<Option<R>>;
fn detach_and_prompt_err(
self,
@ -641,7 +641,7 @@ pub trait DetachAndPromptErr {
);
}
impl<R> DetachAndPromptErr for Task<anyhow::Result<R>>
impl<R> DetachAndPromptErr<R> for Task<anyhow::Result<R>>
where
R: 'static,
{
@ -650,10 +650,11 @@ where
msg: &str,
cx: &mut WindowContext,
f: impl FnOnce(&anyhow::Error, &mut WindowContext) -> Option<String> + 'static,
) -> Task<()> {
) -> Task<Option<R>> {
let msg = msg.to_owned();
cx.spawn(|mut cx| async move {
if let Err(err) = self.await {
let result = self.await;
if let Err(err) = result.as_ref() {
log::error!("{err:?}");
if let Ok(prompt) = cx.update(|cx| {
let detail = f(&err, cx).unwrap_or_else(|| format!("{err}. Please try again."));
@ -661,7 +662,9 @@ where
}) {
prompt.await.ok();
}
return None;
}
return Some(result.unwrap());
})
}