Re-implement actions as derive macros instead of blanket impls

This commit is contained in:
Mikayla 2023-11-16 17:32:02 -08:00
parent a0e976599c
commit 4de2c0f7ef
No known key found for this signature in database
22 changed files with 360 additions and 288 deletions

View file

@ -39,7 +39,7 @@ use futures::FutureExt;
use fuzzy::{StringMatch, StringMatchCandidate};
use git::diff_hunk_to_display;
use gpui::{
action, actions, div, point, prelude::*, px, relative, rems, size, uniform_list, AnyElement,
actions, div, point, prelude::*, px, relative, rems, size, uniform_list, Action, AnyElement,
AppContext, AsyncWindowContext, BackgroundExecutor, Bounds, ClipboardItem, Component, Context,
EventEmitter, FocusHandle, FocusableView, FontFeatures, FontStyle, FontWeight, HighlightStyle,
Hsla, InputHandler, KeyContext, Model, MouseButton, ParentComponent, Pixels, Render, Styled,
@ -180,78 +180,78 @@ pub const FORMAT_TIMEOUT: Duration = Duration::from_secs(2);
// // .with_soft_wrap(true)
// }
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct SelectNext {
#[serde(default)]
pub replace_newest: bool,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct SelectPrevious {
#[serde(default)]
pub replace_newest: bool,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct SelectAllMatches {
#[serde(default)]
pub replace_newest: bool,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct SelectToBeginningOfLine {
#[serde(default)]
stop_at_soft_wraps: bool,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct MovePageUp {
#[serde(default)]
center_cursor: bool,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct MovePageDown {
#[serde(default)]
center_cursor: bool,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct SelectToEndOfLine {
#[serde(default)]
stop_at_soft_wraps: bool,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct ToggleCodeActions {
#[serde(default)]
pub deployed_from_indicator: bool,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct ConfirmCompletion {
#[serde(default)]
pub item_ix: Option<usize>,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct ConfirmCodeAction {
#[serde(default)]
pub item_ix: Option<usize>,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct ToggleComments {
#[serde(default)]
pub advance_downwards: bool,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct FoldAt {
pub buffer_row: u32,
}
#[action]
#[derive(PartialEq, Clone, Deserialize, Action)]
pub struct UnfoldAt {
pub buffer_row: u32,
}