Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Combine `observe_new_views` into one in feedback crate (#6755)
Thomas Coratger47860a5dc81e
diff --git a/crates/feedback/src/feedback.rs b/crates/feedback/src/feedback.rsindex b4d2050d1d0..8749fddaabc 100644--- a/crates/feedback/src/feedback.rs+++ b/crates/feedback/src/feedback.rs@@ -20,28 +20,24 @@ actions!();pub fn init(cx: &mut AppContext) {- // TODO: a way to combine these two into one?- cx.observe_new_views(feedback_modal::FeedbackModal::register)- .detach();-- cx.observe_new_views(|workspace: &mut Workspace, _| {+ cx.observe_new_views(|workspace: &mut Workspace, cx| {+ feedback_modal::FeedbackModal::register(workspace, cx);workspace.register_action(|_, _: &CopySystemSpecsIntoClipboard, cx| {- let specs = SystemSpecs::new(&cx).to_string();+ let specs = SystemSpecs::new(&cx).to_string();- let prompt = cx.prompt(- PromptLevel::Info,- "Copied into clipboard",- Some(&specs),- &["OK"],- );- cx.spawn(|_, _cx| async move {- prompt.await.ok();- })- .detach();- let item = ClipboardItem::new(specs.clone());- cx.write_to_clipboard(item);+ let prompt = cx.prompt(+ PromptLevel::Info,+ "Copied into clipboard",+ Some(&specs),+ &["OK"],+ );+ cx.spawn(|_, _cx| async move {+ prompt.await.ok();})+ .detach();+ cx.write_to_clipboard(ClipboardItem::new(specs.clone()));+ }).register_action(|_, _: &RequestFeature, cx| {let url = "https://github.com/zed-industries/zed/issues/new?assignees=&labels=enhancement%2Ctriage&template=0_feature_request.yml";cx.open_url(url);@@ -56,7 +52,7 @@ pub fn init(cx: &mut AppContext) {.register_action(move |_, _: &OpenZedRepo, cx| {let url = "https://github.com/zed-industries/zed";cx.open_url(&url);- });- })+ });+ }).detach();}