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