From b850e41d6f0515b9f7bc12ed6d6a30222dde1b08 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Tue, 12 Jul 2022 13:34:23 -0700 Subject: [PATCH] Add editor mouse context menu with some basic refactorings and an entry to pop the code actions --- crates/editor/src/mouse_context_menu.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/crates/editor/src/mouse_context_menu.rs b/crates/editor/src/mouse_context_menu.rs index 1313ad346f..be083b2bce 100644 --- a/crates/editor/src/mouse_context_menu.rs +++ b/crates/editor/src/mouse_context_menu.rs @@ -1,11 +1,9 @@ -use context_menu::{ContextMenu, ContextMenuItem}; -use gpui::{ - geometry::vector::Vector2F, impl_internal_actions, MutableAppContext, Task, ViewContext, - ViewHandle, -}; +use context_menu::ContextMenuItem; +use gpui::{geometry::vector::Vector2F, impl_internal_actions, MutableAppContext, ViewContext}; use crate::{ DisplayPoint, Editor, EditorMode, FindAllReferences, GoToDefinition, Rename, SelectMode, + ToggleCodeActions, }; #[derive(Clone, PartialEq)] @@ -20,11 +18,6 @@ pub fn init(cx: &mut MutableAppContext) { cx.add_action(deploy_context_menu); } -pub struct MouseContextMenuState { - pub context_menu: ViewHandle, - pub task: Option>, -} - pub fn deploy_context_menu( editor: &mut Editor, &DeployMouseContextMenu { position, point }: &DeployMouseContextMenu, @@ -53,6 +46,12 @@ pub fn deploy_context_menu( ContextMenuItem::item("Rename Symbol", Rename), ContextMenuItem::item("Go To Definition", GoToDefinition), ContextMenuItem::item("Find All References", FindAllReferences), + ContextMenuItem::item( + "Code Actions", + ToggleCodeActions { + deployed_from_indicator: false, + }, + ), ], cx, );