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