1//! This module contains all actions supported by [`Editor`].
2use super::*;
3use util::serde::default_true;
4
5#[derive(PartialEq, Clone, Deserialize, Default)]
6pub struct SelectNext {
7 #[serde(default)]
8 pub replace_newest: bool,
9}
10
11#[derive(PartialEq, Clone, Deserialize, Default)]
12pub struct SelectPrevious {
13 #[serde(default)]
14 pub replace_newest: bool,
15}
16
17#[derive(PartialEq, Clone, Deserialize, Default)]
18pub struct MoveToBeginningOfLine {
19 #[serde(default = "default_true")]
20 pub(super) stop_at_soft_wraps: bool,
21}
22
23#[derive(PartialEq, Clone, Deserialize, Default)]
24pub struct SelectToBeginningOfLine {
25 #[serde(default)]
26 pub(super) stop_at_soft_wraps: bool,
27}
28
29#[derive(PartialEq, Clone, Deserialize, Default)]
30pub struct MovePageUp {
31 #[serde(default)]
32 pub(super) center_cursor: bool,
33}
34
35#[derive(PartialEq, Clone, Deserialize, Default)]
36pub struct MovePageDown {
37 #[serde(default)]
38 pub(super) center_cursor: bool,
39}
40
41#[derive(PartialEq, Clone, Deserialize, Default)]
42pub struct MoveToEndOfLine {
43 #[serde(default = "default_true")]
44 pub(super) stop_at_soft_wraps: bool,
45}
46
47#[derive(PartialEq, Clone, Deserialize, Default)]
48pub struct SelectToEndOfLine {
49 #[serde(default)]
50 pub(super) stop_at_soft_wraps: bool,
51}
52
53#[derive(PartialEq, Clone, Deserialize, Default)]
54pub struct ToggleCodeActions {
55 #[serde(default)]
56 pub deployed_from_indicator: Option<u32>,
57}
58
59#[derive(PartialEq, Clone, Deserialize, Default)]
60pub struct ToggleTestRunner {
61 #[serde(default)]
62 pub deployed_from_row: Option<u32>,
63}
64
65#[derive(PartialEq, Clone, Deserialize, Default)]
66pub struct ConfirmCompletion {
67 #[serde(default)]
68 pub item_ix: Option<usize>,
69}
70
71#[derive(PartialEq, Clone, Deserialize, Default)]
72pub struct ConfirmCodeAction {
73 #[serde(default)]
74 pub item_ix: Option<usize>,
75}
76
77#[derive(PartialEq, Clone, Deserialize, Default)]
78pub struct ToggleComments {
79 #[serde(default)]
80 pub advance_downwards: bool,
81}
82
83#[derive(PartialEq, Clone, Deserialize, Default)]
84pub struct FoldAt {
85 pub buffer_row: u32,
86}
87
88#[derive(PartialEq, Clone, Deserialize, Default)]
89pub struct UnfoldAt {
90 pub buffer_row: u32,
91}
92
93#[derive(PartialEq, Clone, Deserialize, Default)]
94pub struct MoveUpByLines {
95 #[serde(default)]
96 pub(super) lines: u32,
97}
98
99#[derive(PartialEq, Clone, Deserialize, Default)]
100pub struct MoveDownByLines {
101 #[serde(default)]
102 pub(super) lines: u32,
103}
104#[derive(PartialEq, Clone, Deserialize, Default)]
105pub struct SelectUpByLines {
106 #[serde(default)]
107 pub(super) lines: u32,
108}
109
110#[derive(PartialEq, Clone, Deserialize, Default)]
111pub struct SelectDownByLines {
112 #[serde(default)]
113 pub(super) lines: u32,
114}
115
116#[derive(PartialEq, Clone, Deserialize, Default)]
117pub struct ExpandExcerpts {
118 #[serde(default)]
119 pub(super) lines: u32,
120}
121
122impl_actions!(
123 editor,
124 [
125 ConfirmCodeAction,
126 ConfirmCompletion,
127 ExpandExcerpts,
128 FoldAt,
129 MoveDownByLines,
130 MovePageDown,
131 MovePageUp,
132 MoveToBeginningOfLine,
133 MoveToEndOfLine,
134 MoveUpByLines,
135 SelectDownByLines,
136 SelectNext,
137 SelectPrevious,
138 SelectToBeginningOfLine,
139 SelectToEndOfLine,
140 SelectUpByLines,
141 ToggleCodeActions,
142 ToggleComments,
143 UnfoldAt,
144 ]
145);
146
147gpui::actions!(
148 editor,
149 [
150 AcceptPartialCopilotSuggestion,
151 AcceptPartialInlineCompletion,
152 AddSelectionAbove,
153 AddSelectionBelow,
154 Backspace,
155 Cancel,
156 ConfirmRename,
157 ContextMenuFirst,
158 ContextMenuLast,
159 ContextMenuNext,
160 ContextMenuPrev,
161 ConvertToKebabCase,
162 ConvertToLowerCamelCase,
163 ConvertToLowerCase,
164 ConvertToOppositeCase,
165 ConvertToSnakeCase,
166 ConvertToTitleCase,
167 ConvertToUpperCamelCase,
168 ConvertToUpperCase,
169 Copy,
170 CopyHighlightJson,
171 CopyPath,
172 CopyPermalinkToLine,
173 CopyRelativePath,
174 Cut,
175 CutToEndOfLine,
176 Delete,
177 DeleteLine,
178 DeleteToBeginningOfLine,
179 DeleteToEndOfLine,
180 DeleteToNextSubwordEnd,
181 DeleteToNextWordEnd,
182 DeleteToPreviousSubwordStart,
183 DeleteToPreviousWordStart,
184 DisplayCursorNames,
185 DuplicateLineDown,
186 DuplicateLineUp,
187 ExpandAllHunkDiffs,
188 ExpandMacroRecursively,
189 FindAllReferences,
190 Fold,
191 FoldSelectedRanges,
192 Format,
193 GoToDefinition,
194 GoToDefinitionSplit,
195 GoToDiagnostic,
196 GoToHunk,
197 GoToImplementation,
198 GoToImplementationSplit,
199 GoToPrevDiagnostic,
200 GoToPrevHunk,
201 GoToTypeDefinition,
202 GoToTypeDefinitionSplit,
203 HalfPageDown,
204 HalfPageUp,
205 Hover,
206 Indent,
207 JoinLines,
208 LineDown,
209 LineUp,
210 MoveDown,
211 MoveLeft,
212 MoveLineDown,
213 MoveLineUp,
214 MoveRight,
215 MoveToBeginning,
216 MoveToEnclosingBracket,
217 MoveToEnd,
218 MoveToEndOfParagraph,
219 MoveToNextSubwordEnd,
220 MoveToNextWordEnd,
221 MoveToPreviousSubwordStart,
222 MoveToPreviousWordStart,
223 MoveToStartOfParagraph,
224 MoveUp,
225 Newline,
226 NewlineAbove,
227 NewlineBelow,
228 NextInlineCompletion,
229 NextScreen,
230 OpenExcerpts,
231 OpenExcerptsSplit,
232 OpenPermalinkToLine,
233 OpenUrl,
234 Outdent,
235 PageDown,
236 PageUp,
237 Paste,
238 PreviousInlineCompletion,
239 Redo,
240 RedoSelection,
241 Rename,
242 RestartLanguageServer,
243 RevealInFinder,
244 ReverseLines,
245 RevertSelectedHunks,
246 ScrollCursorBottom,
247 ScrollCursorCenter,
248 ScrollCursorTop,
249 SelectAll,
250 SelectAllMatches,
251 SelectDown,
252 SelectLargerSyntaxNode,
253 SelectLeft,
254 SelectLine,
255 SelectRight,
256 SelectSmallerSyntaxNode,
257 SelectToBeginning,
258 SelectToEnd,
259 SelectToEndOfParagraph,
260 SelectToNextSubwordEnd,
261 SelectToNextWordEnd,
262 SelectToPreviousSubwordStart,
263 SelectToPreviousWordStart,
264 SelectToStartOfParagraph,
265 SelectUp,
266 ShowCharacterPalette,
267 ShowCompletions,
268 ShowInlineCompletion,
269 ShuffleLines,
270 SortLinesCaseInsensitive,
271 SortLinesCaseSensitive,
272 SplitSelectionIntoLines,
273 Tab,
274 TabPrev,
275 ToggleGitBlame,
276 ToggleGitBlameInline,
277 ToggleHunkDiff,
278 ToggleInlayHints,
279 ToggleLineNumbers,
280 ToggleSoftWrap,
281 Transpose,
282 Undo,
283 UndoSelection,
284 UnfoldLines,
285 UniqueLinesCaseInsensitive,
286 UniqueLinesCaseSensitive,
287 ]
288);