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 Outdent,
198 PageDown,
199 PageUp,
200 Paste,
201 Redo,
202 RedoSelection,
203 Rename,
204 RestartLanguageServer,
205 RevealInFinder,
206 ReverseLines,
207 ScrollCursorBottom,
208 ScrollCursorCenter,
209 ScrollCursorTop,
210 SelectAll,
211 SelectAllMatches,
212 SelectDown,
213 SelectLargerSyntaxNode,
214 SelectLeft,
215 SelectLine,
216 SelectRight,
217 SelectSmallerSyntaxNode,
218 SelectToBeginning,
219 SelectToEnd,
220 SelectToEndOfParagraph,
221 SelectToNextSubwordEnd,
222 SelectToNextWordEnd,
223 SelectToPreviousSubwordStart,
224 SelectToPreviousWordStart,
225 SelectToStartOfParagraph,
226 SelectUp,
227 ShowCharacterPalette,
228 ShowCompletions,
229 ShuffleLines,
230 SortLinesCaseInsensitive,
231 SortLinesCaseSensitive,
232 SplitSelectionIntoLines,
233 Tab,
234 TabPrev,
235 ToggleInlayHints,
236 ToggleSoftWrap,
237 Transpose,
238 Undo,
239 UndoSelection,
240 UnfoldLines,
241 ]
242);