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