1//! This module contains all actions supported by [`Editor`].
2use super::*;
3use gpui::{Action, actions};
4use project::project_settings::GoToDiagnosticSeverityFilter;
5use schemars::JsonSchema;
6use util::serde::default_true;
7
8/// Selects the next occurrence of the current selection.
9#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
10#[action(namespace = editor)]
11#[serde(deny_unknown_fields)]
12pub struct SelectNext {
13 #[serde(default)]
14 pub replace_newest: bool,
15}
16
17/// Selects the previous occurrence of the current selection.
18#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
19#[action(namespace = editor)]
20#[serde(deny_unknown_fields)]
21pub struct SelectPrevious {
22 #[serde(default)]
23 pub replace_newest: bool,
24}
25
26/// Moves the cursor to the beginning of the current line.
27#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
28#[action(namespace = editor)]
29#[serde(deny_unknown_fields)]
30pub struct MoveToBeginningOfLine {
31 #[serde(default = "default_true")]
32 pub stop_at_soft_wraps: bool,
33 #[serde(default)]
34 pub stop_at_indent: bool,
35}
36
37/// Selects from the cursor to the beginning of the current line.
38#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
39#[action(namespace = editor)]
40#[serde(deny_unknown_fields)]
41pub struct SelectToBeginningOfLine {
42 #[serde(default)]
43 pub(super) stop_at_soft_wraps: bool,
44 #[serde(default)]
45 pub stop_at_indent: bool,
46}
47
48/// Deletes from the cursor to the beginning of the current line.
49#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
50#[action(namespace = editor)]
51#[serde(deny_unknown_fields)]
52pub struct DeleteToBeginningOfLine {
53 #[serde(default)]
54 pub(super) stop_at_indent: bool,
55}
56
57/// Moves the cursor up by one page.
58#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
59#[action(namespace = editor)]
60#[serde(deny_unknown_fields)]
61pub struct MovePageUp {
62 #[serde(default)]
63 pub(super) center_cursor: bool,
64}
65
66/// Moves the cursor down by one page.
67#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
68#[action(namespace = editor)]
69#[serde(deny_unknown_fields)]
70pub struct MovePageDown {
71 #[serde(default)]
72 pub(super) center_cursor: bool,
73}
74
75/// Moves the cursor to the end of the current line.
76#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
77#[action(namespace = editor)]
78#[serde(deny_unknown_fields)]
79pub struct MoveToEndOfLine {
80 #[serde(default = "default_true")]
81 pub stop_at_soft_wraps: bool,
82}
83
84/// Selects from the cursor to the end of the current line.
85#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
86#[action(namespace = editor)]
87#[serde(deny_unknown_fields)]
88pub struct SelectToEndOfLine {
89 #[serde(default)]
90 pub(super) stop_at_soft_wraps: bool,
91}
92
93/// Toggles the display of available code actions at the cursor position.
94#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
95#[action(namespace = editor)]
96#[serde(deny_unknown_fields)]
97pub struct ToggleCodeActions {
98 // Source from which the action was deployed.
99 #[serde(default)]
100 #[serde(skip)]
101 pub deployed_from: Option<CodeActionSource>,
102 // Run first available task if there is only one.
103 #[serde(default)]
104 #[serde(skip)]
105 pub quick_launch: bool,
106}
107
108#[derive(PartialEq, Clone, Debug)]
109pub enum CodeActionSource {
110 Indicator(DisplayRow),
111 RunMenu(DisplayRow),
112 QuickActionBar,
113}
114
115/// Confirms and accepts the currently selected completion suggestion.
116#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
117#[action(namespace = editor)]
118#[serde(deny_unknown_fields)]
119pub struct ConfirmCompletion {
120 #[serde(default)]
121 pub item_ix: Option<usize>,
122}
123
124/// Composes multiple completion suggestions into a single completion.
125#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
126#[action(namespace = editor)]
127#[serde(deny_unknown_fields)]
128pub struct ComposeCompletion {
129 #[serde(default)]
130 pub item_ix: Option<usize>,
131}
132
133/// Confirms and applies the currently selected code action.
134#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
135#[action(namespace = editor)]
136#[serde(deny_unknown_fields)]
137pub struct ConfirmCodeAction {
138 #[serde(default)]
139 pub item_ix: Option<usize>,
140}
141
142/// Toggles comment markers for the selected lines.
143#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
144#[action(namespace = editor)]
145#[serde(deny_unknown_fields)]
146pub struct ToggleComments {
147 #[serde(default)]
148 pub advance_downwards: bool,
149 #[serde(default)]
150 pub ignore_indent: bool,
151}
152
153/// Toggles block comment markers for the selected text.
154#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
155#[action(namespace = editor)]
156#[serde(deny_unknown_fields)]
157pub struct ToggleBlockComments;
158
159/// Moves the cursor up by a specified number of lines.
160#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
161#[action(namespace = editor)]
162#[serde(deny_unknown_fields)]
163pub struct MoveUpByLines {
164 #[serde(default)]
165 pub(super) lines: u32,
166}
167
168/// Moves the cursor down by a specified number of lines.
169#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
170#[action(namespace = editor)]
171#[serde(deny_unknown_fields)]
172pub struct MoveDownByLines {
173 #[serde(default)]
174 pub(super) lines: u32,
175}
176
177/// Extends selection up by a specified number of lines.
178#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
179#[action(namespace = editor)]
180#[serde(deny_unknown_fields)]
181pub struct SelectUpByLines {
182 #[serde(default)]
183 pub(super) lines: u32,
184}
185
186/// Extends selection down by a specified number of lines.
187#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
188#[action(namespace = editor)]
189#[serde(deny_unknown_fields)]
190pub struct SelectDownByLines {
191 #[serde(default)]
192 pub(super) lines: u32,
193}
194
195/// Expands all excerpts in the editor.
196#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
197#[action(namespace = editor)]
198#[serde(deny_unknown_fields)]
199pub struct ExpandExcerpts {
200 #[serde(default)]
201 pub(super) lines: u32,
202}
203
204/// Expands excerpts above the current position.
205#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
206#[action(namespace = editor)]
207#[serde(deny_unknown_fields)]
208pub struct ExpandExcerptsUp {
209 #[serde(default)]
210 pub(super) lines: u32,
211}
212
213/// Expands excerpts below the current position.
214#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
215#[action(namespace = editor)]
216#[serde(deny_unknown_fields)]
217pub struct ExpandExcerptsDown {
218 #[serde(default)]
219 pub(super) lines: u32,
220}
221
222/// Handles text input in the editor.
223#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
224#[action(namespace = editor)]
225pub struct HandleInput(pub String);
226
227/// Deletes from the cursor to the end of the next word.
228/// Stops before the end of the next word, if whitespace sequences of length >= 2 are encountered.
229#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
230#[action(namespace = editor)]
231#[serde(deny_unknown_fields)]
232pub struct DeleteToNextWordEnd {
233 #[serde(default)]
234 pub ignore_newlines: bool,
235 // Whether to stop before the end of the next word, if language-defined bracket is encountered.
236 #[serde(default)]
237 pub ignore_brackets: bool,
238}
239
240/// Deletes from the cursor to the start of the previous word.
241/// Stops before the start of the previous word, if whitespace sequences of length >= 2 are encountered.
242#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
243#[action(namespace = editor)]
244#[serde(deny_unknown_fields)]
245pub struct DeleteToPreviousWordStart {
246 #[serde(default)]
247 pub ignore_newlines: bool,
248 // Whether to stop before the start of the previous word, if language-defined bracket is encountered.
249 #[serde(default)]
250 pub ignore_brackets: bool,
251}
252
253/// Deletes from the cursor to the end of the next subword.
254/// Stops before the end of the next subword, if whitespace sequences of length >= 2 are encountered.
255#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
256#[action(namespace = editor)]
257#[serde(deny_unknown_fields)]
258pub struct DeleteToNextSubwordEnd {
259 #[serde(default)]
260 pub ignore_newlines: bool,
261 // Whether to stop before the start of the previous word, if language-defined bracket is encountered.
262 #[serde(default)]
263 pub ignore_brackets: bool,
264}
265
266/// Deletes from the cursor to the start of the previous subword.
267/// Stops before the start of the previous subword, if whitespace sequences of length >= 2 are encountered.
268#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
269#[action(namespace = editor)]
270#[serde(deny_unknown_fields)]
271pub struct DeleteToPreviousSubwordStart {
272 #[serde(default)]
273 pub ignore_newlines: bool,
274 // Whether to stop before the start of the previous word, if language-defined bracket is encountered.
275 #[serde(default)]
276 pub ignore_brackets: bool,
277}
278
279/// Cuts from cursor to end of line.
280#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
281#[action(namespace = editor)]
282#[serde(deny_unknown_fields)]
283pub struct CutToEndOfLine {
284 #[serde(default)]
285 pub stop_at_newlines: bool,
286}
287
288/// Folds all code blocks at the specified indentation level.
289#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
290#[action(namespace = editor)]
291pub struct FoldAtLevel(pub u32);
292
293/// Spawns the nearest available task from the current cursor position.
294#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
295#[action(namespace = editor)]
296#[serde(deny_unknown_fields)]
297pub struct SpawnNearestTask {
298 #[serde(default)]
299 pub reveal: task::RevealStrategy,
300}
301
302#[derive(Clone, PartialEq, Action)]
303#[action(no_json, no_register)]
304pub struct DiffClipboardWithSelectionData {
305 pub clipboard_text: String,
306 pub editor: Entity<Editor>,
307}
308
309#[derive(Debug, PartialEq, Eq, Clone, Copy, Deserialize, Default)]
310pub enum UuidVersion {
311 #[default]
312 V4,
313 V7,
314}
315
316/// Splits selection into individual lines.
317#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
318#[action(namespace = editor)]
319#[serde(deny_unknown_fields)]
320pub struct SplitSelectionIntoLines {
321 /// Keep the text selected after splitting instead of collapsing to cursors.
322 #[serde(default)]
323 pub keep_selections: bool,
324}
325
326/// Goes to the next diagnostic in the file.
327#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
328#[action(namespace = editor)]
329#[serde(deny_unknown_fields)]
330pub struct GoToDiagnostic {
331 #[serde(default)]
332 pub severity: GoToDiagnosticSeverityFilter,
333}
334
335/// Goes to the previous diagnostic in the file.
336#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
337#[action(namespace = editor)]
338#[serde(deny_unknown_fields)]
339pub struct GoToPreviousDiagnostic {
340 #[serde(default)]
341 pub severity: GoToDiagnosticSeverityFilter,
342}
343
344/// Adds a cursor above the current selection.
345#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
346#[action(namespace = editor)]
347#[serde(deny_unknown_fields)]
348pub struct AddSelectionAbove {
349 #[serde(default = "default_true")]
350 pub skip_soft_wrap: bool,
351}
352
353/// Adds a cursor below the current selection.
354#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
355#[action(namespace = editor)]
356#[serde(deny_unknown_fields)]
357pub struct AddSelectionBelow {
358 #[serde(default = "default_true")]
359 pub skip_soft_wrap: bool,
360}
361
362/// Inserts a snippet at the cursor.
363#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
364#[action(namespace = editor)]
365#[serde(deny_unknown_fields)]
366pub struct InsertSnippet {
367 /// Language name if using a named snippet, or `None` for a global snippet
368 ///
369 /// This is typically lowercase and matches the filename containing the snippet, without the `.json` extension.
370 pub language: Option<String>,
371 /// Name if using a named snippet
372 pub name: Option<String>,
373
374 /// Snippet body, if not using a named snippet
375 // todo(andrew): use `ListOrDirect` or similar for multiline snippet body
376 pub snippet: Option<String>,
377}
378
379actions!(
380 debugger,
381 [
382 /// Runs program execution to the current cursor position.
383 RunToCursor,
384 /// Evaluates the selected text in the debugger context.
385 EvaluateSelectedText
386 ]
387);
388
389actions!(
390 go_to_line,
391 [
392 /// Toggles the go to line dialog.
393 #[action(name = "Toggle")]
394 ToggleGoToLine
395 ]
396);
397
398actions!(
399 editor,
400 [
401 /// Accepts the full edit prediction.
402 AcceptEditPrediction,
403 /// Accepts a partial edit prediction.
404 #[action(deprecated_aliases = ["editor::AcceptPartialCopilotSuggestion"])]
405 AcceptNextWordEditPrediction,
406 AcceptNextLineEditPrediction,
407 /// Applies all diff hunks in the editor.
408 ApplyAllDiffHunks,
409 /// Applies the diff hunk at the current position.
410 ApplyDiffHunk,
411 /// Deletes the character before the cursor.
412 Backspace,
413 /// Shows git blame information for the current line.
414 BlameHover,
415 /// Cancels the current operation.
416 Cancel,
417 /// Cancels the running flycheck operation.
418 CancelFlycheck,
419 /// Cancels pending language server work.
420 CancelLanguageServerWork,
421 /// Clears flycheck results.
422 ClearFlycheck,
423 /// Confirms the rename operation.
424 ConfirmRename,
425 /// Confirms completion by inserting at cursor.
426 ConfirmCompletionInsert,
427 /// Confirms completion by replacing existing text.
428 ConfirmCompletionReplace,
429 /// Navigates to the first item in the context menu.
430 ContextMenuFirst,
431 /// Navigates to the last item in the context menu.
432 ContextMenuLast,
433 /// Navigates to the next item in the context menu.
434 ContextMenuNext,
435 /// Navigates to the previous item in the context menu.
436 ContextMenuPrevious,
437 /// Converts indentation from tabs to spaces.
438 ConvertIndentationToSpaces,
439 /// Converts indentation from spaces to tabs.
440 ConvertIndentationToTabs,
441 /// Converts selected text to kebab-case.
442 ConvertToKebabCase,
443 /// Converts selected text to lowerCamelCase.
444 ConvertToLowerCamelCase,
445 /// Converts selected text to lowercase.
446 ConvertToLowerCase,
447 /// Toggles the case of selected text.
448 ConvertToOppositeCase,
449 /// Converts selected text to sentence case.
450 ConvertToSentenceCase,
451 /// Converts selected text to snake_case.
452 ConvertToSnakeCase,
453 /// Converts selected text to Title Case.
454 ConvertToTitleCase,
455 /// Converts selected text to UpperCamelCase.
456 ConvertToUpperCamelCase,
457 /// Converts selected text to UPPERCASE.
458 ConvertToUpperCase,
459 /// Applies ROT13 cipher to selected text.
460 ConvertToRot13,
461 /// Applies ROT47 cipher to selected text.
462 ConvertToRot47,
463 /// Copies selected text to the clipboard.
464 Copy,
465 /// Copies selected text to the clipboard with leading/trailing whitespace trimmed.
466 CopyAndTrim,
467 /// Copies the current file location to the clipboard.
468 CopyFileLocation,
469 /// Copies the highlighted text as JSON.
470 CopyHighlightJson,
471 /// Copies the current file name to the clipboard.
472 CopyFileName,
473 /// Copies the file name without extension to the clipboard.
474 CopyFileNameWithoutExtension,
475 /// Copies a permalink to the current line.
476 CopyPermalinkToLine,
477 /// Cuts selected text to the clipboard.
478 Cut,
479 /// Deletes the character after the cursor.
480 Delete,
481 /// Deletes the current line.
482 DeleteLine,
483 /// Deletes from cursor to end of line.
484 DeleteToEndOfLine,
485 /// Diffs the text stored in the clipboard against the current selection.
486 DiffClipboardWithSelection,
487 /// Displays names of all active cursors.
488 DisplayCursorNames,
489 /// Duplicates the current line below.
490 DuplicateLineDown,
491 /// Duplicates the current line above.
492 DuplicateLineUp,
493 /// Duplicates the current selection.
494 DuplicateSelection,
495 /// Expands all diff hunks in the editor.
496 #[action(deprecated_aliases = ["editor::ExpandAllHunkDiffs"])]
497 ExpandAllDiffHunks,
498 /// Collapses all diff hunks in the editor.
499 CollapseAllDiffHunks,
500 /// Expands macros recursively at cursor position.
501 ExpandMacroRecursively,
502 /// Finds the next match in the search.
503 FindNextMatch,
504 /// Finds the previous match in the search.
505 FindPreviousMatch,
506 /// Folds the current code block.
507 Fold,
508 /// Folds all foldable regions in the editor.
509 FoldAll,
510 /// Folds all code blocks at indentation level 1.
511 #[action(name = "FoldAtLevel_1")]
512 FoldAtLevel1,
513 /// Folds all code blocks at indentation level 2.
514 #[action(name = "FoldAtLevel_2")]
515 FoldAtLevel2,
516 /// Folds all code blocks at indentation level 3.
517 #[action(name = "FoldAtLevel_3")]
518 FoldAtLevel3,
519 /// Folds all code blocks at indentation level 4.
520 #[action(name = "FoldAtLevel_4")]
521 FoldAtLevel4,
522 /// Folds all code blocks at indentation level 5.
523 #[action(name = "FoldAtLevel_5")]
524 FoldAtLevel5,
525 /// Folds all code blocks at indentation level 6.
526 #[action(name = "FoldAtLevel_6")]
527 FoldAtLevel6,
528 /// Folds all code blocks at indentation level 7.
529 #[action(name = "FoldAtLevel_7")]
530 FoldAtLevel7,
531 /// Folds all code blocks at indentation level 8.
532 #[action(name = "FoldAtLevel_8")]
533 FoldAtLevel8,
534 /// Folds all code blocks at indentation level 9.
535 #[action(name = "FoldAtLevel_9")]
536 FoldAtLevel9,
537 /// Folds all function bodies in the editor.
538 FoldFunctionBodies,
539 /// Folds the current code block and all its children.
540 FoldRecursive,
541 /// Folds the selected ranges.
542 FoldSelectedRanges,
543 /// Toggles focus back to the last active buffer.
544 ToggleFocus,
545 /// Toggles folding at the current position.
546 ToggleFold,
547 /// Toggles recursive folding at the current position.
548 ToggleFoldRecursive,
549 /// Toggles all folds in a buffer or all excerpts in multibuffer.
550 ToggleFoldAll,
551 /// Formats the entire document.
552 Format,
553 /// Formats only the selected text.
554 ///
555 /// This action is only available when the active formatter can format ranges.
556 /// When using a language server, this sends an LSP range formatting request for each
557 /// selection, and is hidden when the selected buffer's configured language server does
558 /// not advertise range-formatting support. When using Prettier, Prettier's own range
559 /// formatting is used to format the encompassing range of all selections, and resulting
560 /// edits outside the selected ranges are discarded. External command formatters do not
561 /// support range formatting and are skipped.
562 FormatSelections,
563 /// Goes to the declaration of the symbol at cursor.
564 GoToDeclaration,
565 /// Goes to declaration in a split pane.
566 GoToDeclarationSplit,
567 /// Goes to the definition of the symbol at cursor.
568 GoToDefinition,
569 /// Goes to definition in a split pane.
570 GoToDefinitionSplit,
571 /// Goes to the next diff hunk.
572 GoToHunk,
573 /// Goes to the previous diff hunk.
574 GoToPreviousHunk,
575 /// Goes to the implementation of the symbol at cursor.
576 GoToImplementation,
577 /// Goes to implementation in a split pane.
578 GoToImplementationSplit,
579 /// Goes to the next bookmark in the file.
580 GoToNextBookmark,
581 /// Goes to the next change in the file.
582 GoToNextChange,
583 /// Goes to the parent module of the current file.
584 GoToParentModule,
585 /// Goes to the previous bookmark in the file.
586 GoToPreviousBookmark,
587 /// Goes to the previous change in the file.
588 GoToPreviousChange,
589 /// Goes to the next symbol.
590 GoToNextSymbol,
591 /// Goes to the previous symbol.
592 GoToPreviousSymbol,
593 /// Goes to the next reference to the symbol under the cursor.
594 GoToNextReference,
595 /// Goes to the previous reference to the symbol under the cursor.
596 GoToPreviousReference,
597 /// Goes to the type definition of the symbol at cursor.
598 GoToTypeDefinition,
599 /// Goes to type definition in a split pane.
600 GoToTypeDefinitionSplit,
601 /// Goes to the next document highlight.
602 GoToNextDocumentHighlight,
603 /// Goes to the previous document highlight.
604 GoToPreviousDocumentHighlight,
605 /// Scrolls down by half a page.
606 HalfPageDown,
607 /// Scrolls up by half a page.
608 HalfPageUp,
609 /// Shows hover information for the symbol at cursor.
610 Hover,
611 /// Increases indentation of selected lines.
612 Indent,
613 /// Inserts a UUID v4 at cursor position.
614 InsertUuidV4,
615 /// Inserts a UUID v7 at cursor position.
616 InsertUuidV7,
617 /// Joins the current line with the next line.
618 JoinLines,
619 /// Cuts to kill ring (Emacs-style).
620 KillRingCut,
621 /// Yanks from kill ring (Emacs-style).
622 KillRingYank,
623 /// Moves cursor down one line.
624 LineDown,
625 /// Moves cursor up one line.
626 LineUp,
627 /// Moves cursor left.
628 MoveLeft,
629 /// Moves the current line down.
630 MoveLineDown,
631 /// Moves the current line up.
632 MoveLineUp,
633 /// Moves cursor right.
634 MoveRight,
635 /// Moves cursor to the beginning of the document.
636 MoveToBeginning,
637 /// Moves cursor to the enclosing bracket.
638 MoveToEnclosingBracket,
639 /// Moves cursor to the end of the document.
640 MoveToEnd,
641 /// Moves cursor to the end of the paragraph.
642 MoveToEndOfParagraph,
643 /// Moves cursor to the end of the next subword.
644 MoveToNextSubwordEnd,
645 /// Moves cursor to the end of the next word.
646 MoveToNextWordEnd,
647 /// Moves cursor to the start of the previous subword.
648 MoveToPreviousSubwordStart,
649 /// Moves cursor to the start of the previous word.
650 MoveToPreviousWordStart,
651 /// Moves cursor to the start of the paragraph.
652 MoveToStartOfParagraph,
653 /// Moves cursor to the start of the current excerpt.
654 MoveToStartOfExcerpt,
655 /// Moves cursor to the start of the next excerpt.
656 MoveToStartOfNextExcerpt,
657 /// Moves cursor to the end of the current excerpt.
658 MoveToEndOfExcerpt,
659 /// Moves cursor to the end of the previous excerpt.
660 MoveToEndOfPreviousExcerpt,
661 /// Moves cursor to the start of the next larger syntax node.
662 MoveToStartOfLargerSyntaxNode,
663 /// Moves cursor to the end of the next larger syntax node.
664 MoveToEndOfLargerSyntaxNode,
665 /// Inserts a new line and moves cursor to it.
666 Newline,
667 /// Inserts a new line above the current line.
668 NewlineAbove,
669 /// Inserts a new line below the current line.
670 NewlineBelow,
671 /// Navigates to the next edit prediction.
672 NextEditPrediction,
673 /// Scrolls to the next screen.
674 NextScreen,
675 /// Goes to the next snippet tabstop if one exists.
676 NextSnippetTabstop,
677 /// Opens a view of all bookmarks in the project.
678 ViewBookmarks,
679 /// Opens the context menu at cursor position.
680 OpenContextMenu,
681 /// Opens excerpts from the current file.
682 OpenExcerpts,
683 /// Opens excerpts in a split pane.
684 OpenExcerptsSplit,
685 /// Opens the proposed changes editor.
686 OpenProposedChangesEditor,
687 /// Opens documentation for the symbol at cursor.
688 OpenDocs,
689 /// Opens a permalink to the current line.
690 OpenPermalinkToLine,
691 /// Opens the file whose name is selected in the editor.
692 #[action(deprecated_aliases = ["editor::OpenFile"])]
693 OpenSelectedFilename,
694 /// Opens all selections in a multibuffer.
695 OpenSelectionsInMultibuffer,
696 /// Opens the URL at cursor position.
697 OpenUrl,
698 /// Organizes import statements.
699 OrganizeImports,
700 /// Decreases indentation of selected lines.
701 Outdent,
702 /// Automatically adjusts indentation based on context.
703 AutoIndent,
704 /// Scrolls down by one page.
705 PageDown,
706 /// Scrolls up by one page.
707 PageUp,
708 /// Pastes from clipboard.
709 Paste,
710 /// Navigates to the previous edit prediction.
711 PreviousEditPrediction,
712 /// Goes to the previous snippet tabstop if one exists.
713 PreviousSnippetTabstop,
714 /// Redoes the last undone edit.
715 Redo,
716 /// Redoes the last selection change.
717 RedoSelection,
718 /// Renames the symbol at cursor.
719 Rename,
720 /// Restarts the language server for the current file.
721 RestartLanguageServer,
722 /// Reverses the order of selected lines.
723 ReverseLines,
724 /// Reloads the file from disk.
725 ReloadFile,
726 /// Rewraps text to fit within the preferred line length.
727 Rewrap,
728 /// Rotates selections or lines backward.
729 RotateSelectionsBackward,
730 /// Rotates selections or lines forward.
731 RotateSelectionsForward,
732 /// Runs flycheck diagnostics.
733 RunFlycheck,
734 /// Scrolls the cursor to the bottom of the viewport.
735 ScrollCursorBottom,
736 /// Scrolls the cursor to the center of the viewport.
737 ScrollCursorCenter,
738 /// Cycles cursor position between center, top, and bottom.
739 ScrollCursorCenterTopBottom,
740 /// Scrolls the cursor to the top of the viewport.
741 ScrollCursorTop,
742 /// Selects all text in the editor.
743 SelectAll,
744 /// Selects all matches of the current selection.
745 SelectAllMatches,
746 /// Selects to the start of the current excerpt.
747 SelectToStartOfExcerpt,
748 /// Selects to the start of the next excerpt.
749 SelectToStartOfNextExcerpt,
750 /// Selects to the end of the current excerpt.
751 SelectToEndOfExcerpt,
752 /// Selects to the end of the previous excerpt.
753 SelectToEndOfPreviousExcerpt,
754 /// Extends selection down.
755 SelectDown,
756 /// Selects the enclosing symbol.
757 SelectEnclosingSymbol,
758 /// Selects to the start of the next larger syntax node.
759 SelectToStartOfLargerSyntaxNode,
760 /// Selects to the end of the next larger syntax node.
761 SelectToEndOfLargerSyntaxNode,
762 /// Selects the next larger syntax node.
763 SelectLargerSyntaxNode,
764 /// Selects the next syntax node sibling.
765 SelectNextSyntaxNode,
766 /// Selects the previous syntax node sibling.
767 SelectPreviousSyntaxNode,
768 /// Extends selection left.
769 SelectLeft,
770 /// Selects the current line.
771 SelectLine,
772 /// Extends selection down by one page.
773 SelectPageDown,
774 /// Extends selection up by one page.
775 SelectPageUp,
776 /// Extends selection right.
777 SelectRight,
778 /// Selects the next smaller syntax node.
779 SelectSmallerSyntaxNode,
780 /// Selects to the beginning of the document.
781 SelectToBeginning,
782 /// Selects to the end of the document.
783 SelectToEnd,
784 /// Selects to the end of the paragraph.
785 SelectToEndOfParagraph,
786 /// Selects to the end of the next subword.
787 SelectToNextSubwordEnd,
788 /// Selects to the end of the next word.
789 SelectToNextWordEnd,
790 /// Selects to the start of the previous subword.
791 SelectToPreviousSubwordStart,
792 /// Selects to the start of the previous word.
793 SelectToPreviousWordStart,
794 /// Selects to the start of the paragraph.
795 SelectToStartOfParagraph,
796 /// Extends selection up.
797 SelectUp,
798 /// Shows code completion suggestions at the cursor position.
799 ShowCompletions,
800 /// Shows the system character palette.
801 ShowCharacterPalette,
802 /// Shows edit prediction at cursor.
803 ShowEditPrediction,
804 /// Shows signature help for the current function.
805 ShowSignatureHelp,
806 /// Shows word completions.
807 ShowWordCompletions,
808 /// Randomly shuffles selected lines.
809 ShuffleLines,
810 /// Navigates to the next signature in the signature help popup.
811 SignatureHelpNext,
812 /// Navigates to the previous signature in the signature help popup.
813 SignatureHelpPrevious,
814 /// Sorts selected lines by length.
815 SortLinesByLength,
816 /// Sorts selected lines case-insensitively.
817 SortLinesCaseInsensitive,
818 /// Sorts selected lines case-sensitively.
819 SortLinesCaseSensitive,
820 /// Stops the language server for the current file.
821 StopLanguageServer,
822 /// Switches between source and header files.
823 SwitchSourceHeader,
824 /// Inserts a tab character or indents.
825 Tab,
826 /// Removes a tab character or outdents.
827 Backtab,
828 /// Toggles a bookmark at the current line.
829 ToggleBookmark,
830 /// Toggles a breakpoint at the current line.
831 ToggleBreakpoint,
832 /// Toggles the case of selected text.
833 ToggleCase,
834 /// Disables the breakpoint at the current line.
835 DisableBreakpoint,
836 /// Enables the breakpoint at the current line.
837 EnableBreakpoint,
838 /// Edits the log message for a breakpoint.
839 EditLogBreakpoint,
840 /// Toggles automatic signature help.
841 ToggleAutoSignatureHelp,
842 /// Toggles inline git blame display.
843 ToggleGitBlameInline,
844 /// Opens the git commit for the blame at cursor.
845 OpenGitBlameCommit,
846 /// Toggles the diagnostics panel.
847 ToggleDiagnostics,
848 /// Toggles indent guides display.
849 ToggleIndentGuides,
850 /// Toggles inlay hints display.
851 ToggleInlayHints,
852 /// Toggles code lens display.
853 ToggleCodeLens,
854 /// Toggles semantic highlights display.
855 ToggleSemanticHighlights,
856 /// Toggles inline values display.
857 ToggleInlineValues,
858 /// Toggles inline diagnostics display.
859 ToggleInlineDiagnostics,
860 /// Toggles edit prediction feature.
861 ToggleEditPrediction,
862 /// Toggles line numbers display.
863 ToggleLineNumbers,
864 /// Toggles the minimap display.
865 ToggleMinimap,
866 /// Swaps the start and end of the current selection.
867 SwapSelectionEnds,
868 /// Sets a mark at the current position.
869 SetMark,
870 /// Toggles relative line numbers display.
871 ToggleRelativeLineNumbers,
872 /// Toggles diff display for selected hunks.
873 #[action(deprecated_aliases = ["editor::ToggleHunkDiff"])]
874 ToggleSelectedDiffHunks,
875 /// Stores the diff review comment locally (for later batch submission).
876 SubmitDiffReviewComment,
877 /// Toggles the expanded state of the comments section in the overlay.
878 ToggleReviewCommentsExpanded,
879 /// Sends all stored review comments to the Agent panel.
880 SendReviewToAgent,
881 /// Toggles the selection menu.
882 ToggleSelectionMenu,
883 /// Toggles soft wrap mode.
884 ToggleSoftWrap,
885 /// Toggles the tab bar display.
886 ToggleTabBar,
887 /// Transposes characters around cursor.
888 Transpose,
889 /// Undoes the last edit.
890 Undo,
891 /// Undoes the last selection change.
892 UndoSelection,
893 /// Unfolds all folded regions.
894 UnfoldAll,
895 /// Unfolds lines at cursor.
896 UnfoldLines,
897 /// Unfolds recursively at cursor.
898 UnfoldRecursive,
899 /// Removes duplicate lines (case-insensitive).
900 UniqueLinesCaseInsensitive,
901 /// Removes duplicate lines (case-sensitive).
902 UniqueLinesCaseSensitive,
903 /// Removes the surrounding syntax node (for example brackets, or closures)
904 /// from the current selections.
905 UnwrapSyntaxNode,
906 /// Wraps selections in tag specified by language.
907 WrapSelectionsInTag,
908 /// Aligns selections from different rows into the same column
909 AlignSelections,
910 ]
911);
912
913/// Finds all references to the symbol at cursor.
914#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
915#[action(namespace = editor)]
916#[serde(deny_unknown_fields)]
917pub struct FindAllReferences {
918 #[serde(default = "default_true")]
919 pub always_open_multibuffer: bool,
920}
921
922impl Default for FindAllReferences {
923 fn default() -> Self {
924 Self {
925 always_open_multibuffer: true,
926 }
927 }
928}
929
930/// Edits a stored review comment inline.
931#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
932#[action(namespace = editor)]
933#[serde(deny_unknown_fields)]
934pub struct EditReviewComment {
935 pub id: usize,
936}
937
938/// Deletes a stored review comment.
939#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
940#[action(namespace = editor)]
941#[serde(deny_unknown_fields)]
942pub struct DeleteReviewComment {
943 pub id: usize,
944}
945
946/// Confirms an inline edit of a review comment.
947#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
948#[action(namespace = editor)]
949#[serde(deny_unknown_fields)]
950pub struct ConfirmEditReviewComment {
951 pub id: usize,
952}
953
954/// Cancels an inline edit of a review comment.
955#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
956#[action(namespace = editor)]
957#[serde(deny_unknown_fields)]
958pub struct CancelEditReviewComment {
959 pub id: usize,
960}