mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 13:10:54 +00:00
Add editor mouse context menu with some basic refactorings and an entry to pop the code actions
This commit is contained in:
parent
d796b543e0
commit
b850e41d6f
1 changed files with 9 additions and 10 deletions
|
@ -1,11 +1,9 @@
|
||||||
use context_menu::{ContextMenu, ContextMenuItem};
|
use context_menu::ContextMenuItem;
|
||||||
use gpui::{
|
use gpui::{geometry::vector::Vector2F, impl_internal_actions, MutableAppContext, ViewContext};
|
||||||
geometry::vector::Vector2F, impl_internal_actions, MutableAppContext, Task, ViewContext,
|
|
||||||
ViewHandle,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
DisplayPoint, Editor, EditorMode, FindAllReferences, GoToDefinition, Rename, SelectMode,
|
DisplayPoint, Editor, EditorMode, FindAllReferences, GoToDefinition, Rename, SelectMode,
|
||||||
|
ToggleCodeActions,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone, PartialEq)]
|
||||||
|
@ -20,11 +18,6 @@ pub fn init(cx: &mut MutableAppContext) {
|
||||||
cx.add_action(deploy_context_menu);
|
cx.add_action(deploy_context_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MouseContextMenuState {
|
|
||||||
pub context_menu: ViewHandle<ContextMenu>,
|
|
||||||
pub task: Option<Task<()>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn deploy_context_menu(
|
pub fn deploy_context_menu(
|
||||||
editor: &mut Editor,
|
editor: &mut Editor,
|
||||||
&DeployMouseContextMenu { position, point }: &DeployMouseContextMenu,
|
&DeployMouseContextMenu { position, point }: &DeployMouseContextMenu,
|
||||||
|
@ -53,6 +46,12 @@ pub fn deploy_context_menu(
|
||||||
ContextMenuItem::item("Rename Symbol", Rename),
|
ContextMenuItem::item("Rename Symbol", Rename),
|
||||||
ContextMenuItem::item("Go To Definition", GoToDefinition),
|
ContextMenuItem::item("Go To Definition", GoToDefinition),
|
||||||
ContextMenuItem::item("Find All References", FindAllReferences),
|
ContextMenuItem::item("Find All References", FindAllReferences),
|
||||||
|
ContextMenuItem::item(
|
||||||
|
"Code Actions",
|
||||||
|
ToggleCodeActions {
|
||||||
|
deployed_from_indicator: false,
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue