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