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        GoToImplementation,
169        GoToImplementationSplit,
170        OpenUrl,
171        HalfPageDown,
172        HalfPageUp,
173        Hover,
174        Indent,
175        JoinLines,
176        LineDown,
177        LineUp,
178        MoveDown,
179        MoveLeft,
180        MoveLineDown,
181        MoveLineUp,
182        MoveRight,
183        MoveToBeginning,
184        MoveToBeginningOfLine,
185        MoveToEnclosingBracket,
186        MoveToEnd,
187        MoveToEndOfLine,
188        MoveToEndOfParagraph,
189        MoveToNextSubwordEnd,
190        MoveToNextWordEnd,
191        MoveToPreviousSubwordStart,
192        MoveToPreviousWordStart,
193        MoveToStartOfParagraph,
194        MoveUp,
195        Newline,
196        NewlineAbove,
197        NewlineBelow,
198        NextScreen,
199        OpenExcerpts,
200        OpenPermalinkToLine,
201        Outdent,
202        PageDown,
203        PageUp,
204        Paste,
205        Redo,
206        RedoSelection,
207        Rename,
208        RestartLanguageServer,
209        RevealInFinder,
210        ReverseLines,
211        ScrollCursorBottom,
212        ScrollCursorCenter,
213        ScrollCursorTop,
214        SelectAll,
215        SelectAllMatches,
216        SelectDown,
217        SelectLargerSyntaxNode,
218        SelectLeft,
219        SelectLine,
220        SelectRight,
221        SelectSmallerSyntaxNode,
222        SelectToBeginning,
223        SelectToEnd,
224        SelectToEndOfParagraph,
225        SelectToNextSubwordEnd,
226        SelectToNextWordEnd,
227        SelectToPreviousSubwordStart,
228        SelectToPreviousWordStart,
229        SelectToStartOfParagraph,
230        SelectUp,
231        ShowCharacterPalette,
232        ShowCompletions,
233        ShuffleLines,
234        SortLinesCaseInsensitive,
235        SortLinesCaseSensitive,
236        SplitSelectionIntoLines,
237        Tab,
238        TabPrev,
239        ToggleInlayHints,
240        ToggleSoftWrap,
241        Transpose,
242        Undo,
243        UndoSelection,
244        UnfoldLines,
245        UniqueLinesCaseSensitive,
246        UniqueLinesCaseInsensitive
247    ]
248);