Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix up warnings, bind 'Done' button to DismissEvent
Piotr Osiewicz0670a6f838e0
diff --git a/crates/copilot_button/src/copilot_button.rs b/crates/copilot_button/src/copilot_button.rsindex 6bf1d6cfcc9..2a1bde785e0 100644--- a/crates/copilot_button/src/copilot_button.rs+++ b/crates/copilot_button/src/copilot_button.rs@@ -376,9 +376,11 @@ fn initiate_sign_in(cx: &mut WindowContext) {}_ => {copilot.update(cx, |this, cx| this.sign_in(cx)).detach();- workspace.update(cx, |this, cx| {- this.toggle_modal(cx, |cx| CopilotCodeVerification::new(&copilot, cx));- });+ workspace+ .update(cx, |this, cx| {+ this.toggle_modal(cx, |cx| CopilotCodeVerification::new(&copilot, cx));+ })+ .ok();}}}diff --git a/crates/copilot_button/src/sign_in.rs b/crates/copilot_button/src/sign_in.rsindex 15e68f961e9..d3e52c3e19d 100644--- a/crates/copilot_button/src/sign_in.rs+++ b/crates/copilot_button/src/sign_in.rs@@ -1,17 +1,14 @@use copilot::{request::PromptUserDeviceFlow, Copilot, Status};use gpui::{- div, size, svg, AppContext, Bounds, ClipboardItem, DismissEvent, Element, EventEmitter,- FocusHandle, FocusableView, GlobalPixels, InteractiveElement, IntoElement, Model,- ParentElement, Point, Render, Styled, Subscription, ViewContext, VisualContext, WindowBounds,- WindowHandle, WindowKind, WindowOptions,+ div, svg, AppContext, ClipboardItem, DismissEvent, Element, EventEmitter, FocusHandle,+ FocusableView, InteractiveElement, IntoElement, Model, ParentElement, Render, Styled,+ Subscription, ViewContext,};use ui::{prelude::*, Button, Icon, Label};use workspace::ModalView;const COPILOT_SIGN_UP_URL: &'static str = "https://github.com/features/copilot";-pub fn init(cx: &mut AppContext) {}-pub struct CopilotCodeVerification {status: Status,connect_clicked: bool,@@ -20,7 +17,7 @@ pub struct CopilotCodeVerification {}impl FocusableView for CopilotCodeVerification {- fn focus_handle(&self, cx: &AppContext) -> gpui::FocusHandle {+ fn focus_handle(&self, _: &AppContext) -> gpui::FocusHandle {self.focus_handle.clone()}}@@ -111,13 +108,16 @@ impl CopilotCodeVerification {.style(ButtonStyle::Filled),)}- fn render_enabled_modal() -> impl Element {+ fn render_enabled_modal(cx: &mut ViewContext<Self>) -> impl Element {v_stack().child(Label::new("Copilot Enabled!")).child(Label::new("You can update your settings or sign out from the Copilot menu in the status bar.",))- .child(Button::new("copilot-enabled-done-button", "Done").on_click(|_, cx| {}))+ .child(+ Button::new("copilot-enabled-done-button", "Done")+ .on_click(cx.listener(|_, _, cx| cx.emit(DismissEvent))),+ )}fn render_unauthorized_modal() -> impl Element {@@ -148,7 +148,7 @@ impl Render for CopilotCodeVerification {}Status::Authorized => {self.connect_clicked = false;- Self::render_enabled_modal().into_any_element()+ Self::render_enabled_modal(cx).into_any_element()}_ => div().into_any_element(),};