actions.rs

  1//! This module contains all actions supported by [`Editor`].
  2use super::*;
  3
  4#[derive(PartialEq, Clone, Deserialize, Default)]
  5pub struct SelectNext {
  6    #[serde(default)]
  7    pub replace_newest: bool,
  8}
  9
 10#[derive(PartialEq, Clone, Deserialize, Default)]
 11pub struct SelectPrevious {
 12    #[serde(default)]
 13    pub replace_newest: bool,
 14}
 15
 16#[derive(PartialEq, Clone, Deserialize, Default)]
 17pub struct SelectToBeginningOfLine {
 18    #[serde(default)]
 19    pub(super) stop_at_soft_wraps: bool,
 20}
 21
 22#[derive(PartialEq, Clone, Deserialize, Default)]
 23pub struct MovePageUp {
 24    #[serde(default)]
 25    pub(super) center_cursor: bool,
 26}
 27
 28#[derive(PartialEq, Clone, Deserialize, Default)]
 29pub struct MovePageDown {
 30    #[serde(default)]
 31    pub(super) center_cursor: bool,
 32}
 33
 34#[derive(PartialEq, Clone, Deserialize, Default)]
 35pub struct SelectToEndOfLine {
 36    #[serde(default)]
 37    pub(super) stop_at_soft_wraps: bool,
 38}
 39
 40#[derive(PartialEq, Clone, Deserialize, Default)]
 41pub struct ToggleCodeActions {
 42    #[serde(default)]
 43    pub deployed_from_indicator: bool,
 44}
 45
 46#[derive(PartialEq, Clone, Deserialize, Default)]
 47pub struct ConfirmCompletion {
 48    #[serde(default)]
 49    pub item_ix: Option<usize>,
 50}
 51
 52#[derive(PartialEq, Clone, Deserialize, Default)]
 53pub struct ConfirmCodeAction {
 54    #[serde(default)]
 55    pub item_ix: Option<usize>,
 56}
 57
 58#[derive(PartialEq, Clone, Deserialize, Default)]
 59pub struct ToggleComments {
 60    #[serde(default)]
 61    pub advance_downwards: bool,
 62}
 63
 64#[derive(PartialEq, Clone, Deserialize, Default)]
 65pub struct FoldAt {
 66    pub buffer_row: u32,
 67}
 68
 69#[derive(PartialEq, Clone, Deserialize, Default)]
 70pub struct UnfoldAt {
 71    pub buffer_row: u32,
 72}
 73
 74#[derive(PartialEq, Clone, Deserialize, Default)]
 75pub struct MoveUpByLines {
 76    #[serde(default)]
 77    pub(super) lines: u32,
 78}
 79
 80#[derive(PartialEq, Clone, Deserialize, Default)]
 81pub struct MoveDownByLines {
 82    #[serde(default)]
 83    pub(super) lines: u32,
 84}
 85#[derive(PartialEq, Clone, Deserialize, Default)]
 86pub struct SelectUpByLines {
 87    #[serde(default)]
 88    pub(super) lines: u32,
 89}
 90
 91#[derive(PartialEq, Clone, Deserialize, Default)]
 92pub struct SelectDownByLines {
 93    #[serde(default)]
 94    pub(super) lines: u32,
 95}
 96
 97impl_actions!(
 98    editor,
 99    [
100        SelectNext,
101        SelectPrevious,
102        SelectToBeginningOfLine,
103        MovePageUp,
104        MovePageDown,
105        SelectToEndOfLine,
106        ToggleCodeActions,
107        ConfirmCompletion,
108        ConfirmCodeAction,
109        ToggleComments,
110        FoldAt,
111        UnfoldAt,
112        MoveUpByLines,
113        MoveDownByLines,
114        SelectUpByLines,
115        SelectDownByLines
116    ]
117);
118
119gpui::actions!(
120    editor,
121    [
122        AddSelectionAbove,
123        AddSelectionBelow,
124        Backspace,
125        Cancel,
126        ConfirmRename,
127        ContextMenuFirst,
128        ContextMenuLast,
129        ContextMenuNext,
130        ContextMenuPrev,
131        ConvertToKebabCase,
132        ConvertToLowerCamelCase,
133        ConvertToLowerCase,
134        ConvertToSnakeCase,
135        ConvertToTitleCase,
136        ConvertToUpperCamelCase,
137        ConvertToUpperCase,
138        Copy,
139        CopyHighlightJson,
140        CopyPath,
141        CopyPermalinkToLine,
142        CopyRelativePath,
143        Cut,
144        CutToEndOfLine,
145        Delete,
146        DeleteLine,
147        DeleteToBeginningOfLine,
148        DeleteToEndOfLine,
149        DeleteToNextSubwordEnd,
150        DeleteToNextWordEnd,
151        DeleteToPreviousSubwordStart,
152        DeleteToPreviousWordStart,
153        DisplayCursorNames,
154        DuplicateLine,
155        ExpandMacroRecursively,
156        FindAllReferences,
157        Fold,
158        FoldSelectedRanges,
159        Format,
160        GoToDefinition,
161        GoToDefinitionSplit,
162        GoToDiagnostic,
163        GoToHunk,
164        GoToPrevDiagnostic,
165        GoToPrevHunk,
166        GoToTypeDefinition,
167        GoToTypeDefinitionSplit,
168        OpenUrl,
169        HalfPageDown,
170        HalfPageUp,
171        Hover,
172        Indent,
173        JoinLines,
174        LineDown,
175        LineUp,
176        MoveDown,
177        MoveLeft,
178        MoveLineDown,
179        MoveLineUp,
180        MoveRight,
181        MoveToBeginning,
182        MoveToBeginningOfLine,
183        MoveToEnclosingBracket,
184        MoveToEnd,
185        MoveToEndOfLine,
186        MoveToEndOfParagraph,
187        MoveToNextSubwordEnd,
188        MoveToNextWordEnd,
189        MoveToPreviousSubwordStart,
190        MoveToPreviousWordStart,
191        MoveToStartOfParagraph,
192        MoveUp,
193        Newline,
194        NewlineAbove,
195        NewlineBelow,
196        NextScreen,
197        OpenExcerpts,
198        OpenPermalinkToLine,
199        Outdent,
200        PageDown,
201        PageUp,
202        Paste,
203        Redo,
204        RedoSelection,
205        Rename,
206        RestartLanguageServer,
207        RevealInFinder,
208        ReverseLines,
209        ScrollCursorBottom,
210        ScrollCursorCenter,
211        ScrollCursorTop,
212        SelectAll,
213        SelectAllMatches,
214        SelectDown,
215        SelectLargerSyntaxNode,
216        SelectLeft,
217        SelectLine,
218        SelectRight,
219        SelectSmallerSyntaxNode,
220        SelectToBeginning,
221        SelectToEnd,
222        SelectToEndOfParagraph,
223        SelectToNextSubwordEnd,
224        SelectToNextWordEnd,
225        SelectToPreviousSubwordStart,
226        SelectToPreviousWordStart,
227        SelectToStartOfParagraph,
228        SelectUp,
229        ShowCharacterPalette,
230        ShowCompletions,
231        ShuffleLines,
232        SortLinesCaseInsensitive,
233        SortLinesCaseSensitive,
234        SplitSelectionIntoLines,
235        Tab,
236        TabPrev,
237        ToggleInlayHints,
238        ToggleSoftWrap,
239        Transpose,
240        Undo,
241        UndoSelection,
242        UnfoldLines,
243        UniqueLinesCaseSensitive,
244        UniqueLinesCaseInsensitive
245    ]
246);