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
 97#[derive(PartialEq, Clone, Deserialize, Default)]
 98pub struct DuplicateLine {
 99    #[serde(default)]
100    pub move_upwards: bool,
101}
102
103impl_actions!(
104    editor,
105    [
106        SelectNext,
107        SelectPrevious,
108        SelectToBeginningOfLine,
109        MovePageUp,
110        MovePageDown,
111        SelectToEndOfLine,
112        ToggleCodeActions,
113        ConfirmCompletion,
114        ConfirmCodeAction,
115        ToggleComments,
116        FoldAt,
117        UnfoldAt,
118        MoveUpByLines,
119        MoveDownByLines,
120        SelectUpByLines,
121        SelectDownByLines,
122        DuplicateLine
123    ]
124);
125
126gpui::actions!(
127    editor,
128    [
129        AcceptPartialCopilotSuggestion,
130        AddSelectionAbove,
131        AddSelectionBelow,
132        Backspace,
133        Cancel,
134        ConfirmRename,
135        ContextMenuFirst,
136        ContextMenuLast,
137        ContextMenuNext,
138        ContextMenuPrev,
139        ConvertToKebabCase,
140        ConvertToLowerCamelCase,
141        ConvertToLowerCase,
142        ConvertToSnakeCase,
143        ConvertToTitleCase,
144        ConvertToUpperCamelCase,
145        ConvertToUpperCase,
146        Copy,
147        CopyHighlightJson,
148        CopyPath,
149        CopyPermalinkToLine,
150        CopyRelativePath,
151        Cut,
152        CutToEndOfLine,
153        Delete,
154        DeleteLine,
155        DeleteToBeginningOfLine,
156        DeleteToEndOfLine,
157        DeleteToNextSubwordEnd,
158        DeleteToNextWordEnd,
159        DeleteToPreviousSubwordStart,
160        DeleteToPreviousWordStart,
161        DisplayCursorNames,
162        ExpandMacroRecursively,
163        FindAllReferences,
164        Fold,
165        FoldSelectedRanges,
166        Format,
167        GoToDefinition,
168        GoToDefinitionSplit,
169        GoToDiagnostic,
170        GoToHunk,
171        GoToPrevDiagnostic,
172        GoToPrevHunk,
173        GoToTypeDefinition,
174        GoToTypeDefinitionSplit,
175        GoToImplementation,
176        GoToImplementationSplit,
177        OpenUrl,
178        HalfPageDown,
179        HalfPageUp,
180        Hover,
181        Indent,
182        JoinLines,
183        LineDown,
184        LineUp,
185        MoveDown,
186        MoveLeft,
187        MoveLineDown,
188        MoveLineUp,
189        MoveRight,
190        MoveToBeginning,
191        MoveToBeginningOfLine,
192        MoveToEnclosingBracket,
193        MoveToEnd,
194        MoveToEndOfLine,
195        MoveToEndOfParagraph,
196        MoveToNextSubwordEnd,
197        MoveToNextWordEnd,
198        MoveToPreviousSubwordStart,
199        MoveToPreviousWordStart,
200        MoveToStartOfParagraph,
201        MoveUp,
202        Newline,
203        NewlineAbove,
204        NewlineBelow,
205        NextScreen,
206        OpenExcerpts,
207        OpenExcerptsSplit,
208        OpenPermalinkToLine,
209        Outdent,
210        PageDown,
211        PageUp,
212        Paste,
213        Redo,
214        RedoSelection,
215        Rename,
216        RestartLanguageServer,
217        RevealInFinder,
218        ReverseLines,
219        ScrollCursorBottom,
220        ScrollCursorCenter,
221        ScrollCursorTop,
222        SelectAll,
223        SelectAllMatches,
224        SelectDown,
225        SelectLargerSyntaxNode,
226        SelectLeft,
227        SelectLine,
228        SelectRight,
229        SelectSmallerSyntaxNode,
230        SelectToBeginning,
231        SelectToEnd,
232        SelectToEndOfParagraph,
233        SelectToNextSubwordEnd,
234        SelectToNextWordEnd,
235        SelectToPreviousSubwordStart,
236        SelectToPreviousWordStart,
237        SelectToStartOfParagraph,
238        SelectUp,
239        ShowCharacterPalette,
240        ShowCompletions,
241        ShuffleLines,
242        SortLinesCaseInsensitive,
243        SortLinesCaseSensitive,
244        SplitSelectionIntoLines,
245        Tab,
246        TabPrev,
247        ToggleInlayHints,
248        ToggleSoftWrap,
249        ToggleLineNumbers,
250        Transpose,
251        Undo,
252        UndoSelection,
253        UnfoldLines,
254        UniqueLinesCaseSensitive,
255        UniqueLinesCaseInsensitive
256    ]
257);