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        AcceptPartialCopilotSuggestion,
123        AcceptPartialInlineCompletion,
124        AddSelectionAbove,
125        AddSelectionBelow,
126        Backspace,
127        Cancel,
128        ConfirmRename,
129        ContextMenuFirst,
130        ContextMenuLast,
131        ContextMenuNext,
132        ContextMenuPrev,
133        ConvertToKebabCase,
134        ConvertToLowerCamelCase,
135        ConvertToLowerCase,
136        ConvertToSnakeCase,
137        ConvertToTitleCase,
138        ConvertToUpperCamelCase,
139        ConvertToUpperCase,
140        Copy,
141        CopyHighlightJson,
142        CopyPath,
143        CopyPermalinkToLine,
144        CopyRelativePath,
145        Cut,
146        CutToEndOfLine,
147        Delete,
148        DeleteLine,
149        DeleteToBeginningOfLine,
150        DeleteToEndOfLine,
151        DeleteToNextSubwordEnd,
152        DeleteToNextWordEnd,
153        DeleteToPreviousSubwordStart,
154        DeleteToPreviousWordStart,
155        DisplayCursorNames,
156        DuplicateLineUp,
157        DuplicateLineDown,
158        ExpandMacroRecursively,
159        FindAllReferences,
160        Fold,
161        FoldSelectedRanges,
162        Format,
163        GoToDefinition,
164        GoToDefinitionSplit,
165        GoToDiagnostic,
166        GoToHunk,
167        GoToImplementation,
168        GoToImplementationSplit,
169        GoToPrevDiagnostic,
170        GoToPrevHunk,
171        GoToTypeDefinition,
172        GoToTypeDefinitionSplit,
173        HalfPageDown,
174        HalfPageUp,
175        Hover,
176        Indent,
177        JoinLines,
178        LineDown,
179        LineUp,
180        MoveDown,
181        MoveLeft,
182        MoveLineDown,
183        MoveLineUp,
184        MoveRight,
185        MoveToBeginning,
186        MoveToBeginningOfLine,
187        MoveToEnclosingBracket,
188        MoveToEnd,
189        MoveToEndOfLine,
190        MoveToEndOfParagraph,
191        MoveToNextSubwordEnd,
192        MoveToNextWordEnd,
193        MoveToPreviousSubwordStart,
194        MoveToPreviousWordStart,
195        MoveToStartOfParagraph,
196        MoveUp,
197        Newline,
198        NewlineAbove,
199        NewlineBelow,
200        NextInlineCompletion,
201        NextScreen,
202        OpenExcerpts,
203        OpenExcerptsSplit,
204        OpenPermalinkToLine,
205        OpenUrl,
206        Outdent,
207        PageDown,
208        PageUp,
209        Paste,
210        PreviousInlineCompletion,
211        Redo,
212        RedoSelection,
213        Rename,
214        RestartLanguageServer,
215        RevealInFinder,
216        ReverseLines,
217        RevertSelectedHunks,
218        ScrollCursorBottom,
219        ScrollCursorCenter,
220        ScrollCursorTop,
221        SelectAll,
222        SelectAllMatches,
223        SelectDown,
224        SelectLargerSyntaxNode,
225        SelectLeft,
226        SelectLine,
227        SelectRight,
228        SelectSmallerSyntaxNode,
229        SelectToBeginning,
230        SelectToEnd,
231        SelectToEndOfParagraph,
232        SelectToNextSubwordEnd,
233        SelectToNextWordEnd,
234        SelectToPreviousSubwordStart,
235        SelectToPreviousWordStart,
236        SelectToStartOfParagraph,
237        SelectUp,
238        ShowCharacterPalette,
239        ShowCompletions,
240        ShowInlineCompletion,
241        ShuffleLines,
242        SortLinesCaseInsensitive,
243        SortLinesCaseSensitive,
244        SplitSelectionIntoLines,
245        Tab,
246        TabPrev,
247        ToggleGitBlame,
248        ToggleInlayHints,
249        ToggleLineNumbers,
250        ToggleSoftWrap,
251        Transpose,
252        Undo,
253        UndoSelection,
254        UnfoldLines,
255        UniqueLinesCaseSensitive,
256        UniqueLinesCaseInsensitive
257    ]
258);