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}
 73impl_actions!(
 74    editor,
 75    [
 76        SelectNext,
 77        SelectPrevious,
 78        SelectToBeginningOfLine,
 79        MovePageUp,
 80        MovePageDown,
 81        SelectToEndOfLine,
 82        ToggleCodeActions,
 83        ConfirmCompletion,
 84        ConfirmCodeAction,
 85        ToggleComments,
 86        FoldAt,
 87        UnfoldAt
 88    ]
 89);
 90
 91gpui::actions!(
 92    editor,
 93    [
 94        AddSelectionAbove,
 95        AddSelectionBelow,
 96        Backspace,
 97        Cancel,
 98        ConfirmRename,
 99        ContextMenuFirst,
100        ContextMenuLast,
101        ContextMenuNext,
102        ContextMenuPrev,
103        ConvertToKebabCase,
104        ConvertToLowerCamelCase,
105        ConvertToLowerCase,
106        ConvertToSnakeCase,
107        ConvertToTitleCase,
108        ConvertToUpperCamelCase,
109        ConvertToUpperCase,
110        Copy,
111        CopyHighlightJson,
112        CopyPath,
113        CopyRelativePath,
114        Cut,
115        CutToEndOfLine,
116        Delete,
117        DeleteLine,
118        DeleteToBeginningOfLine,
119        DeleteToEndOfLine,
120        DeleteToNextSubwordEnd,
121        DeleteToNextWordEnd,
122        DeleteToPreviousSubwordStart,
123        DeleteToPreviousWordStart,
124        DisplayCursorNames,
125        DuplicateLine,
126        ExpandMacroRecursively,
127        FindAllReferences,
128        Fold,
129        FoldSelectedRanges,
130        Format,
131        GoToDefinition,
132        GoToDefinitionSplit,
133        GoToDiagnostic,
134        GoToHunk,
135        GoToPrevDiagnostic,
136        GoToPrevHunk,
137        GoToTypeDefinition,
138        GoToTypeDefinitionSplit,
139        HalfPageDown,
140        HalfPageUp,
141        Hover,
142        Indent,
143        JoinLines,
144        LineDown,
145        LineUp,
146        MoveDown,
147        MoveLeft,
148        MoveLineDown,
149        MoveLineUp,
150        MoveRight,
151        MoveToBeginning,
152        MoveToBeginningOfLine,
153        MoveToEnclosingBracket,
154        MoveToEnd,
155        MoveToEndOfLine,
156        MoveToEndOfParagraph,
157        MoveToNextSubwordEnd,
158        MoveToNextWordEnd,
159        MoveToPreviousSubwordStart,
160        MoveToPreviousWordStart,
161        MoveToStartOfParagraph,
162        MoveUp,
163        Newline,
164        NewlineAbove,
165        NewlineBelow,
166        NextScreen,
167        OpenExcerpts,
168        Outdent,
169        PageDown,
170        PageUp,
171        Paste,
172        Redo,
173        RedoSelection,
174        Rename,
175        RestartLanguageServer,
176        RevealInFinder,
177        ReverseLines,
178        ScrollCursorBottom,
179        ScrollCursorCenter,
180        ScrollCursorTop,
181        SelectAll,
182        SelectAllMatches,
183        SelectDown,
184        SelectLargerSyntaxNode,
185        SelectLeft,
186        SelectLine,
187        SelectRight,
188        SelectSmallerSyntaxNode,
189        SelectToBeginning,
190        SelectToEnd,
191        SelectToEndOfParagraph,
192        SelectToNextSubwordEnd,
193        SelectToNextWordEnd,
194        SelectToPreviousSubwordStart,
195        SelectToPreviousWordStart,
196        SelectToStartOfParagraph,
197        SelectUp,
198        ShowCharacterPalette,
199        ShowCompletions,
200        ShuffleLines,
201        SortLinesCaseInsensitive,
202        SortLinesCaseSensitive,
203        SplitSelectionIntoLines,
204        Tab,
205        TabPrev,
206        ToggleInlayHints,
207        ToggleSoftWrap,
208        Transpose,
209        Undo,
210        UndoSelection,
211        UnfoldLines,
212    ]
213);