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