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        CopyPermalinkToLine,
114        CopyRelativePath,
115        Cut,
116        CutToEndOfLine,
117        Delete,
118        DeleteLine,
119        DeleteToBeginningOfLine,
120        DeleteToEndOfLine,
121        DeleteToNextSubwordEnd,
122        DeleteToNextWordEnd,
123        DeleteToPreviousSubwordStart,
124        DeleteToPreviousWordStart,
125        DisplayCursorNames,
126        DuplicateLine,
127        ExpandMacroRecursively,
128        FindAllReferences,
129        Fold,
130        FoldSelectedRanges,
131        Format,
132        GoToDefinition,
133        GoToDefinitionSplit,
134        GoToDiagnostic,
135        GoToHunk,
136        GoToPrevDiagnostic,
137        GoToPrevHunk,
138        GoToTypeDefinition,
139        GoToTypeDefinitionSplit,
140        HalfPageDown,
141        HalfPageUp,
142        Hover,
143        Indent,
144        JoinLines,
145        LineDown,
146        LineUp,
147        MoveDown,
148        MoveLeft,
149        MoveLineDown,
150        MoveLineUp,
151        MoveRight,
152        MoveToBeginning,
153        MoveToBeginningOfLine,
154        MoveToEnclosingBracket,
155        MoveToEnd,
156        MoveToEndOfLine,
157        MoveToEndOfParagraph,
158        MoveToNextSubwordEnd,
159        MoveToNextWordEnd,
160        MoveToPreviousSubwordStart,
161        MoveToPreviousWordStart,
162        MoveToStartOfParagraph,
163        MoveUp,
164        Newline,
165        NewlineAbove,
166        NewlineBelow,
167        NextScreen,
168        OpenExcerpts,
169        Outdent,
170        PageDown,
171        PageUp,
172        Paste,
173        Redo,
174        RedoSelection,
175        Rename,
176        RestartLanguageServer,
177        RevealInFinder,
178        ReverseLines,
179        ScrollCursorBottom,
180        ScrollCursorCenter,
181        ScrollCursorTop,
182        SelectAll,
183        SelectAllMatches,
184        SelectDown,
185        SelectLargerSyntaxNode,
186        SelectLeft,
187        SelectLine,
188        SelectRight,
189        SelectSmallerSyntaxNode,
190        SelectToBeginning,
191        SelectToEnd,
192        SelectToEndOfParagraph,
193        SelectToNextSubwordEnd,
194        SelectToNextWordEnd,
195        SelectToPreviousSubwordStart,
196        SelectToPreviousWordStart,
197        SelectToStartOfParagraph,
198        SelectUp,
199        ShowCharacterPalette,
200        ShowCompletions,
201        ShuffleLines,
202        SortLinesCaseInsensitive,
203        SortLinesCaseSensitive,
204        SplitSelectionIntoLines,
205        Tab,
206        TabPrev,
207        ToggleInlayHints,
208        ToggleSoftWrap,
209        Transpose,
210        Undo,
211        UndoSelection,
212        UnfoldLines,
213    ]
214);