Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

extensions_ui: Show an error toast when a dev extension fails to install (#22914)

Marshall Bowerscb77ee04ec8f
diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rs
index 0ed79c250b5..09c7d69f2c8 100644
--- a/crates/extensions_ui/src/extensions_ui.rs
+++ b/crates/extensions_ui/src/extensions_ui.rs
@@ -82,13 +82,26 @@ pub fn init(cx: &mut AppContext) {
}
};
- store
+ let install_task = store
.update(&mut cx, |store, cx| {
- store
- .install_dev_extension(extension_path, cx)
- .detach_and_log_err(cx)
+ store.install_dev_extension(extension_path, cx)
})
.ok()?;
+
+ match install_task.await {
+ Ok(_) => {}
+ Err(err) => {
+ workspace_handle
+ .update(&mut cx, |workspace, cx| {
+ workspace.show_error(
+ &err.context("failed to install dev extension"),
+ cx,
+ );
+ })
+ .ok();
+ }
+ }
+
Some(())
})
.detach();
diff --git a/crates/workspace/src/notifications.rs b/crates/workspace/src/notifications.rs
index fd989554e9f..7f92b3be80d 100644
--- a/crates/workspace/src/notifications.rs
+++ b/crates/workspace/src/notifications.rs
@@ -392,7 +392,10 @@ impl Render for ErrorMessagePrompt {
)
.child(
div()
+ .id("error_message")
.max_w_80()
+ .max_h_40()
+ .overflow_y_scroll()
.child(Label::new(self.message.clone()).size(LabelSize::Small)),
)
.when_some(self.label_and_url_button.clone(), |elm, (label, url)| {