Confirm code action on mouse down
This commit is contained in:
parent
fb450e35f7
commit
c44db3b7ec
2 changed files with 16 additions and 5 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue