Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Confirm code action on mouse down
Antonio Scandurrac44db3b7ecf1
diff --git a/crates/editor2/Cargo.toml b/crates/editor2/Cargo.tomlindex 493f10006f7..e45c33d9175 100644--- a/crates/editor2/Cargo.toml+++ b/crates/editor2/Cargo.toml@@ -44,7 +44,7 @@ snippet = { path = "../snippet" }sum_tree = { path = "../sum_tree" }text = { package="text2", path = "../text2" }theme = { package="theme2", path = "../theme2" }-ui2 = { package = "ui2", path = "../ui2" }+ui = { package = "ui2", path = "../ui2" }util = { path = "../util" }sqlez = { path = "../sqlez" }workspace = { package = "workspace2", path = "../workspace2" }diff --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rsindex 4fafedbfcce..5e00faf3d20 100644--- a/crates/editor2/src/editor.rs+++ b/crates/editor2/src/editor.rs@@ -42,9 +42,9 @@ use gpui::{action, actions, div, point, px, relative, rems, size, uniform_list, AnyElement, AppContext,AsyncWindowContext, BackgroundExecutor, Bounds, ClipboardItem, Component, Context,DispatchContext, EventEmitter, FocusHandle, FontFeatures, FontStyle, FontWeight,- HighlightStyle, Hsla, InputHandler, Model, ParentElement, Pixels, Render, StatelessInteractive,- Styled, Subscription, Task, TextStyle, UniformListScrollHandle, View, ViewContext,- VisualContext, WeakView, WindowContext,+ HighlightStyle, Hsla, InputHandler, Model, MouseButton, ParentElement, Pixels, Render,+ StatelessInteractive, Styled, Subscription, Task, TextStyle, UniformListScrollHandle, View,+ ViewContext, VisualContext, WeakView, WindowContext,};use highlight_matching_bracket::refresh_matching_bracket_highlights;use hover_popover::{hide_hover, HoverState};@@ -1586,6 +1586,17 @@ impl CodeActionsMenu {.bg(colors.element_hover).text_color(colors.text_accent)})+ .on_mouse_down(MouseButton::Left, move |editor: &mut Editor, _, cx| {+ cx.stop_propagation();+ editor+ .confirm_code_action(+ &ConfirmCodeAction {+ item_ix: Some(item_ix),+ },+ cx,+ )+ .map(|task| task.detach_and_log_err(cx));+ }).child(action.lsp_action.title.clone())}).collect()@@ -4429,7 +4440,7 @@ impl Editor {) -> Option<AnyElement<Self>> {if self.available_code_actions.is_some() {Some(- IconButton::new("code_actions_indicator", ui2::Icon::Bolt)+ IconButton::new("code_actions_indicator", ui::Icon::Bolt).on_click(|editor: &mut Editor, cx| {editor.toggle_code_actions(&ToggleCodeActions {