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        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        ExpandMacroRecursively,
164        FindAllReferences,
165        Fold,
166        FoldSelectedRanges,
167        Format,
168        GoToDefinition,
169        GoToDefinitionSplit,
170        GoToDiagnostic,
171        GoToHunk,
172        GoToImplementation,
173        GoToImplementationSplit,
174        GoToPrevDiagnostic,
175        GoToPrevHunk,
176        GoToTypeDefinition,
177        GoToTypeDefinitionSplit,
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        NextInlineCompletion,
206        NextScreen,
207        OpenExcerpts,
208        OpenExcerptsSplit,
209        OpenPermalinkToLine,
210        OpenUrl,
211        Outdent,
212        PageDown,
213        PageUp,
214        Paste,
215        PreviousInlineCompletion,
216        Redo,
217        RedoSelection,
218        Rename,
219        RestartLanguageServer,
220        RevealInFinder,
221        ReverseLines,
222        RevertSelectedHunks,
223        ScrollCursorBottom,
224        ScrollCursorCenter,
225        ScrollCursorTop,
226        SelectAll,
227        SelectAllMatches,
228        SelectDown,
229        SelectLargerSyntaxNode,
230        SelectLeft,
231        SelectLine,
232        SelectRight,
233        SelectSmallerSyntaxNode,
234        SelectToBeginning,
235        SelectToEnd,
236        SelectToEndOfParagraph,
237        SelectToNextSubwordEnd,
238        SelectToNextWordEnd,
239        SelectToPreviousSubwordStart,
240        SelectToPreviousWordStart,
241        SelectToStartOfParagraph,
242        SelectUp,
243        ShowCharacterPalette,
244        ShowCompletions,
245        ShowInlineCompletion,
246        ShuffleLines,
247        SortLinesCaseInsensitive,
248        SortLinesCaseSensitive,
249        SplitSelectionIntoLines,
250        Tab,
251        TabPrev,
252        ToggleInlayHints,
253        ToggleLineNumbers,
254        ToggleSoftWrap,
255        Transpose,
256        Undo,
257        UndoSelection,
258        UnfoldLines,
259        UniqueLinesCaseSensitive,
260        UniqueLinesCaseInsensitive
261    ]
262);