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        RevertSelectedHunks,
214        Redo,
215        RedoSelection,
216        Rename,
217        RestartLanguageServer,
218        RevealInFinder,
219        ReverseLines,
220        ScrollCursorBottom,
221        ScrollCursorCenter,
222        ScrollCursorTop,
223        SelectAll,
224        SelectAllMatches,
225        SelectDown,
226        SelectLargerSyntaxNode,
227        SelectLeft,
228        SelectLine,
229        SelectRight,
230        SelectSmallerSyntaxNode,
231        SelectToBeginning,
232        SelectToEnd,
233        SelectToEndOfParagraph,
234        SelectToNextSubwordEnd,
235        SelectToNextWordEnd,
236        SelectToPreviousSubwordStart,
237        SelectToPreviousWordStart,
238        SelectToStartOfParagraph,
239        SelectUp,
240        ShowCharacterPalette,
241        ShowCompletions,
242        ShuffleLines,
243        SortLinesCaseInsensitive,
244        SortLinesCaseSensitive,
245        SplitSelectionIntoLines,
246        Tab,
247        TabPrev,
248        ToggleInlayHints,
249        ToggleSoftWrap,
250        ToggleLineNumbers,
251        Transpose,
252        Undo,
253        UndoSelection,
254        UnfoldLines,
255        UniqueLinesCaseSensitive,
256        UniqueLinesCaseInsensitive
257    ]
258);