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 GoToImplementation,
169 GoToImplementationSplit,
170 OpenUrl,
171 HalfPageDown,
172 HalfPageUp,
173 Hover,
174 Indent,
175 JoinLines,
176 LineDown,
177 LineUp,
178 MoveDown,
179 MoveLeft,
180 MoveLineDown,
181 MoveLineUp,
182 MoveRight,
183 MoveToBeginning,
184 MoveToBeginningOfLine,
185 MoveToEnclosingBracket,
186 MoveToEnd,
187 MoveToEndOfLine,
188 MoveToEndOfParagraph,
189 MoveToNextSubwordEnd,
190 MoveToNextWordEnd,
191 MoveToPreviousSubwordStart,
192 MoveToPreviousWordStart,
193 MoveToStartOfParagraph,
194 MoveUp,
195 Newline,
196 NewlineAbove,
197 NewlineBelow,
198 NextScreen,
199 OpenExcerpts,
200 OpenExcerptsSplit,
201 OpenPermalinkToLine,
202 Outdent,
203 PageDown,
204 PageUp,
205 Paste,
206 Redo,
207 RedoSelection,
208 Rename,
209 RestartLanguageServer,
210 RevealInFinder,
211 ReverseLines,
212 ScrollCursorBottom,
213 ScrollCursorCenter,
214 ScrollCursorTop,
215 SelectAll,
216 SelectAllMatches,
217 SelectDown,
218 SelectLargerSyntaxNode,
219 SelectLeft,
220 SelectLine,
221 SelectRight,
222 SelectSmallerSyntaxNode,
223 SelectToBeginning,
224 SelectToEnd,
225 SelectToEndOfParagraph,
226 SelectToNextSubwordEnd,
227 SelectToNextWordEnd,
228 SelectToPreviousSubwordStart,
229 SelectToPreviousWordStart,
230 SelectToStartOfParagraph,
231 SelectUp,
232 ShowCharacterPalette,
233 ShowCompletions,
234 ShuffleLines,
235 SortLinesCaseInsensitive,
236 SortLinesCaseSensitive,
237 SplitSelectionIntoLines,
238 Tab,
239 TabPrev,
240 ToggleInlayHints,
241 ToggleSoftWrap,
242 Transpose,
243 Undo,
244 UndoSelection,
245 UnfoldLines,
246 UniqueLinesCaseSensitive,
247 UniqueLinesCaseInsensitive
248 ]
249);