Permanent fix to repeat MouseRegion Tag failure in Workspace
Polish tab bar buttons Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
co-authored by
Mikayla Maki
parent
69ecbb644d
commit
6b26965074
@@ -682,7 +682,7 @@ impl CompletionsMenu {
|
||||
let completion = &completions[mat.candidate_id];
|
||||
let item_ix = start_ix + ix;
|
||||
items.push(
|
||||
MouseEventHandler::new::<CompletionTag, _, _>(
|
||||
MouseEventHandler::<CompletionTag>::new(
|
||||
mat.candidate_id,
|
||||
cx,
|
||||
|state, _| {
|
||||
@@ -830,7 +830,7 @@ impl CodeActionsMenu {
|
||||
for (ix, action) in actions[range].iter().enumerate() {
|
||||
let item_ix = start_ix + ix;
|
||||
items.push(
|
||||
MouseEventHandler::new::<ActionTag, _, _>(item_ix, cx, |state, _| {
|
||||
MouseEventHandler::<ActionTag>::new(item_ix, cx, |state, _| {
|
||||
let item_style = if item_ix == selected_item {
|
||||
style.autocomplete.selected_item
|
||||
} else if state.hovered {
|
||||
@@ -2735,7 +2735,7 @@ impl Editor {
|
||||
if self.available_code_actions.is_some() {
|
||||
enum Tag {}
|
||||
Some(
|
||||
MouseEventHandler::new::<Tag, _, _>(0, cx, |_, _| {
|
||||
MouseEventHandler::<Tag>::new(0, cx, |_, _| {
|
||||
Svg::new("icons/bolt_8.svg")
|
||||
.with_color(style.code_actions.indicator)
|
||||
.boxed()
|
||||
@@ -7100,7 +7100,7 @@ mod tests {
|
||||
fn test_navigation_history(cx: &mut gpui::MutableAppContext) {
|
||||
cx.set_global(Settings::test(cx));
|
||||
use workspace::Item;
|
||||
let (_, pane) = cx.add_window(Default::default(), |cx| Pane::new(false, cx));
|
||||
let (_, pane) = cx.add_window(Default::default(), |cx| Pane::new(None, cx));
|
||||
let buffer = MultiBuffer::build_simple(&sample_text(300, 5, 'a'), cx);
|
||||
|
||||
cx.add_view(&pane, |cx| {
|
||||
|
||||
@@ -1138,7 +1138,7 @@ impl EditorElement {
|
||||
|
||||
enum JumpIcon {}
|
||||
cx.render(&editor, |_, cx| {
|
||||
MouseEventHandler::new::<JumpIcon, _, _>(*key, cx, |state, _| {
|
||||
MouseEventHandler::<JumpIcon>::new(*key, cx, |state, _| {
|
||||
let style = style.jump_icon.style_for(state, false);
|
||||
Svg::new("icons/arrow_up_right_8.svg")
|
||||
.with_color(style.color)
|
||||
|
||||
@@ -312,7 +312,7 @@ pub struct InfoPopover {
|
||||
|
||||
impl InfoPopover {
|
||||
pub fn render(&self, style: &EditorStyle, cx: &mut RenderContext<Editor>) -> ElementBox {
|
||||
MouseEventHandler::new::<InfoPopover, _, _>(0, cx, |_, cx| {
|
||||
MouseEventHandler::<InfoPopover>::new(0, cx, |_, cx| {
|
||||
let mut flex = Flex::new(Axis::Vertical).scrollable::<HoverBlock, _>(1, None, cx);
|
||||
flex.extend(self.contents.iter().map(|content| {
|
||||
let project = self.project.read(cx);
|
||||
@@ -383,7 +383,7 @@ impl DiagnosticPopover {
|
||||
|
||||
let tooltip_style = cx.global::<Settings>().theme.tooltip.clone();
|
||||
|
||||
MouseEventHandler::new::<DiagnosticPopover, _, _>(0, cx, |_, _| {
|
||||
MouseEventHandler::<DiagnosticPopover>::new(0, cx, |_, _| {
|
||||
Text::new(self.local_diagnostic.diagnostic.message.clone(), text_style)
|
||||
.with_soft_wrap(true)
|
||||
.contained()
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
use context_menu::ContextMenuItem;
|
||||
use gpui::{geometry::vector::Vector2F, impl_internal_actions, MutableAppContext, ViewContext};
|
||||
use gpui::{
|
||||
elements::AnchorCorner, geometry::vector::Vector2F, impl_internal_actions, MutableAppContext,
|
||||
ViewContext,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
DisplayPoint, Editor, EditorMode, FindAllReferences, GoToDefinition, GoToTypeDefinition,
|
||||
@@ -46,6 +49,7 @@ pub fn deploy_context_menu(
|
||||
editor.mouse_context_menu.update(cx, |menu, cx| {
|
||||
menu.show(
|
||||
position,
|
||||
AnchorCorner::TopLeft,
|
||||
vec![
|
||||
ContextMenuItem::item("Rename Symbol", Rename),
|
||||
ContextMenuItem::item("Go To Definition", GoToDefinition),
|
||||
|
||||
Reference in New Issue
Block a user