actions.rs

  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        /// When using a language server, this sends an LSP range formatting request for each
556        /// selection. When using Prettier, Prettier's own range formatting is used to format the
557        /// encompassing range of all selections, and resulting edits outside the selected ranges
558        /// are discarded. External command formatters do not support range formatting and are
559        /// skipped.
560        FormatSelections,
561        /// Goes to the declaration of the symbol at cursor.
562        GoToDeclaration,
563        /// Goes to declaration in a split pane.
564        GoToDeclarationSplit,
565        /// Goes to the definition of the symbol at cursor.
566        GoToDefinition,
567        /// Goes to definition in a split pane.
568        GoToDefinitionSplit,
569        /// Goes to the next diff hunk.
570        GoToHunk,
571        /// Goes to the previous diff hunk.
572        GoToPreviousHunk,
573        /// Goes to the implementation of the symbol at cursor.
574        GoToImplementation,
575        /// Goes to implementation in a split pane.
576        GoToImplementationSplit,
577        /// Goes to the next change in the file.
578        GoToNextChange,
579        /// Goes to the parent module of the current file.
580        GoToParentModule,
581        /// Goes to the previous change in the file.
582        GoToPreviousChange,
583        /// Goes to the next symbol.
584        GoToNextSymbol,
585        /// Goes to the previous symbol.
586        GoToPreviousSymbol,
587        /// Goes to the next reference to the symbol under the cursor.
588        GoToNextReference,
589        /// Goes to the previous reference to the symbol under the cursor.
590        GoToPreviousReference,
591        /// Goes to the type definition of the symbol at cursor.
592        GoToTypeDefinition,
593        /// Goes to type definition in a split pane.
594        GoToTypeDefinitionSplit,
595        /// Goes to the next document highlight.
596        GoToNextDocumentHighlight,
597        /// Goes to the previous document highlight.
598        GoToPreviousDocumentHighlight,
599        /// Scrolls down by half a page.
600        HalfPageDown,
601        /// Scrolls up by half a page.
602        HalfPageUp,
603        /// Shows hover information for the symbol at cursor.
604        Hover,
605        /// Increases indentation of selected lines.
606        Indent,
607        /// Inserts a UUID v4 at cursor position.
608        InsertUuidV4,
609        /// Inserts a UUID v7 at cursor position.
610        InsertUuidV7,
611        /// Joins the current line with the next line.
612        JoinLines,
613        /// Cuts to kill ring (Emacs-style).
614        KillRingCut,
615        /// Yanks from kill ring (Emacs-style).
616        KillRingYank,
617        /// Moves cursor down one line.
618        LineDown,
619        /// Moves cursor up one line.
620        LineUp,
621        /// Moves cursor left.
622        MoveLeft,
623        /// Moves the current line down.
624        MoveLineDown,
625        /// Moves the current line up.
626        MoveLineUp,
627        /// Moves cursor right.
628        MoveRight,
629        /// Moves cursor to the beginning of the document.
630        MoveToBeginning,
631        /// Moves cursor to the enclosing bracket.
632        MoveToEnclosingBracket,
633        /// Moves cursor to the end of the document.
634        MoveToEnd,
635        /// Moves cursor to the end of the paragraph.
636        MoveToEndOfParagraph,
637        /// Moves cursor to the end of the next subword.
638        MoveToNextSubwordEnd,
639        /// Moves cursor to the end of the next word.
640        MoveToNextWordEnd,
641        /// Moves cursor to the start of the previous subword.
642        MoveToPreviousSubwordStart,
643        /// Moves cursor to the start of the previous word.
644        MoveToPreviousWordStart,
645        /// Moves cursor to the start of the paragraph.
646        MoveToStartOfParagraph,
647        /// Moves cursor to the start of the current excerpt.
648        MoveToStartOfExcerpt,
649        /// Moves cursor to the start of the next excerpt.
650        MoveToStartOfNextExcerpt,
651        /// Moves cursor to the end of the current excerpt.
652        MoveToEndOfExcerpt,
653        /// Moves cursor to the end of the previous excerpt.
654        MoveToEndOfPreviousExcerpt,
655        /// Moves cursor to the start of the next larger syntax node.
656        MoveToStartOfLargerSyntaxNode,
657        /// Moves cursor to the end of the next larger syntax node.
658        MoveToEndOfLargerSyntaxNode,
659        /// Inserts a new line and moves cursor to it.
660        Newline,
661        /// Inserts a new line above the current line.
662        NewlineAbove,
663        /// Inserts a new line below the current line.
664        NewlineBelow,
665        /// Navigates to the next edit prediction.
666        NextEditPrediction,
667        /// Scrolls to the next screen.
668        NextScreen,
669        /// Goes to the next snippet tabstop if one exists.
670        NextSnippetTabstop,
671        /// Opens the context menu at cursor position.
672        OpenContextMenu,
673        /// Opens excerpts from the current file.
674        OpenExcerpts,
675        /// Opens excerpts in a split pane.
676        OpenExcerptsSplit,
677        /// Opens the proposed changes editor.
678        OpenProposedChangesEditor,
679        /// Opens documentation for the symbol at cursor.
680        OpenDocs,
681        /// Opens a permalink to the current line.
682        OpenPermalinkToLine,
683        /// Opens the file whose name is selected in the editor.
684        #[action(deprecated_aliases = ["editor::OpenFile"])]
685        OpenSelectedFilename,
686        /// Opens all selections in a multibuffer.
687        OpenSelectionsInMultibuffer,
688        /// Opens the URL at cursor position.
689        OpenUrl,
690        /// Organizes import statements.
691        OrganizeImports,
692        /// Decreases indentation of selected lines.
693        Outdent,
694        /// Automatically adjusts indentation based on context.
695        AutoIndent,
696        /// Scrolls down by one page.
697        PageDown,
698        /// Scrolls up by one page.
699        PageUp,
700        /// Pastes from clipboard.
701        Paste,
702        /// Navigates to the previous edit prediction.
703        PreviousEditPrediction,
704        /// Goes to the previous snippet tabstop if one exists.
705        PreviousSnippetTabstop,
706        /// Redoes the last undone edit.
707        Redo,
708        /// Redoes the last selection change.
709        RedoSelection,
710        /// Renames the symbol at cursor.
711        Rename,
712        /// Restarts the language server for the current file.
713        RestartLanguageServer,
714        /// Reverses the order of selected lines.
715        ReverseLines,
716        /// Reloads the file from disk.
717        ReloadFile,
718        /// Rewraps text to fit within the preferred line length.
719        Rewrap,
720        /// Rotates selections or lines backward.
721        RotateSelectionsBackward,
722        /// Rotates selections or lines forward.
723        RotateSelectionsForward,
724        /// Runs flycheck diagnostics.
725        RunFlycheck,
726        /// Scrolls the cursor to the bottom of the viewport.
727        ScrollCursorBottom,
728        /// Scrolls the cursor to the center of the viewport.
729        ScrollCursorCenter,
730        /// Cycles cursor position between center, top, and bottom.
731        ScrollCursorCenterTopBottom,
732        /// Scrolls the cursor to the top of the viewport.
733        ScrollCursorTop,
734        /// Selects all text in the editor.
735        SelectAll,
736        /// Selects all matches of the current selection.
737        SelectAllMatches,
738        /// Selects to the start of the current excerpt.
739        SelectToStartOfExcerpt,
740        /// Selects to the start of the next excerpt.
741        SelectToStartOfNextExcerpt,
742        /// Selects to the end of the current excerpt.
743        SelectToEndOfExcerpt,
744        /// Selects to the end of the previous excerpt.
745        SelectToEndOfPreviousExcerpt,
746        /// Extends selection down.
747        SelectDown,
748        /// Selects the enclosing symbol.
749        SelectEnclosingSymbol,
750        /// Selects to the start of the next larger syntax node.
751        SelectToStartOfLargerSyntaxNode,
752        /// Selects to the end of the next larger syntax node.
753        SelectToEndOfLargerSyntaxNode,
754        /// Selects the next larger syntax node.
755        SelectLargerSyntaxNode,
756        /// Selects the next syntax node sibling.
757        SelectNextSyntaxNode,
758        /// Selects the previous syntax node sibling.
759        SelectPreviousSyntaxNode,
760        /// Extends selection left.
761        SelectLeft,
762        /// Selects the current line.
763        SelectLine,
764        /// Extends selection down by one page.
765        SelectPageDown,
766        /// Extends selection up by one page.
767        SelectPageUp,
768        /// Extends selection right.
769        SelectRight,
770        /// Selects the next smaller syntax node.
771        SelectSmallerSyntaxNode,
772        /// Selects to the beginning of the document.
773        SelectToBeginning,
774        /// Selects to the end of the document.
775        SelectToEnd,
776        /// Selects to the end of the paragraph.
777        SelectToEndOfParagraph,
778        /// Selects to the end of the next subword.
779        SelectToNextSubwordEnd,
780        /// Selects to the end of the next word.
781        SelectToNextWordEnd,
782        /// Selects to the start of the previous subword.
783        SelectToPreviousSubwordStart,
784        /// Selects to the start of the previous word.
785        SelectToPreviousWordStart,
786        /// Selects to the start of the paragraph.
787        SelectToStartOfParagraph,
788        /// Extends selection up.
789        SelectUp,
790        /// Shows code completion suggestions at the cursor position.
791        ShowCompletions,
792        /// Shows the system character palette.
793        ShowCharacterPalette,
794        /// Shows edit prediction at cursor.
795        ShowEditPrediction,
796        /// Shows signature help for the current function.
797        ShowSignatureHelp,
798        /// Shows word completions.
799        ShowWordCompletions,
800        /// Randomly shuffles selected lines.
801        ShuffleLines,
802        /// Navigates to the next signature in the signature help popup.
803        SignatureHelpNext,
804        /// Navigates to the previous signature in the signature help popup.
805        SignatureHelpPrevious,
806        /// Sorts selected lines by length.
807        SortLinesByLength,
808        /// Sorts selected lines case-insensitively.
809        SortLinesCaseInsensitive,
810        /// Sorts selected lines case-sensitively.
811        SortLinesCaseSensitive,
812        /// Stops the language server for the current file.
813        StopLanguageServer,
814        /// Switches between source and header files.
815        SwitchSourceHeader,
816        /// Inserts a tab character or indents.
817        Tab,
818        /// Removes a tab character or outdents.
819        Backtab,
820        /// Toggles a breakpoint at the current line.
821        ToggleBreakpoint,
822        /// Toggles the case of selected text.
823        ToggleCase,
824        /// Disables the breakpoint at the current line.
825        DisableBreakpoint,
826        /// Enables the breakpoint at the current line.
827        EnableBreakpoint,
828        /// Edits the log message for a breakpoint.
829        EditLogBreakpoint,
830        /// Toggles automatic signature help.
831        ToggleAutoSignatureHelp,
832        /// Toggles inline git blame display.
833        ToggleGitBlameInline,
834        /// Opens the git commit for the blame at cursor.
835        OpenGitBlameCommit,
836        /// Toggles the diagnostics panel.
837        ToggleDiagnostics,
838        /// Toggles indent guides display.
839        ToggleIndentGuides,
840        /// Toggles inlay hints display.
841        ToggleInlayHints,
842        /// Toggles semantic highlights display.
843        ToggleSemanticHighlights,
844        /// Toggles inline values display.
845        ToggleInlineValues,
846        /// Toggles inline diagnostics display.
847        ToggleInlineDiagnostics,
848        /// Toggles edit prediction feature.
849        ToggleEditPrediction,
850        /// Toggles line numbers display.
851        ToggleLineNumbers,
852        /// Toggles the minimap display.
853        ToggleMinimap,
854        /// Swaps the start and end of the current selection.
855        SwapSelectionEnds,
856        /// Sets a mark at the current position.
857        SetMark,
858        /// Toggles relative line numbers display.
859        ToggleRelativeLineNumbers,
860        /// Toggles diff display for selected hunks.
861        #[action(deprecated_aliases = ["editor::ToggleHunkDiff"])]
862        ToggleSelectedDiffHunks,
863        /// Stores the diff review comment locally (for later batch submission).
864        SubmitDiffReviewComment,
865        /// Toggles the expanded state of the comments section in the overlay.
866        ToggleReviewCommentsExpanded,
867        /// Sends all stored review comments to the Agent panel.
868        SendReviewToAgent,
869        /// Toggles the selection menu.
870        ToggleSelectionMenu,
871        /// Toggles soft wrap mode.
872        ToggleSoftWrap,
873        /// Toggles the tab bar display.
874        ToggleTabBar,
875        /// Transposes characters around cursor.
876        Transpose,
877        /// Undoes the last edit.
878        Undo,
879        /// Undoes the last selection change.
880        UndoSelection,
881        /// Unfolds all folded regions.
882        UnfoldAll,
883        /// Unfolds lines at cursor.
884        UnfoldLines,
885        /// Unfolds recursively at cursor.
886        UnfoldRecursive,
887        /// Removes duplicate lines (case-insensitive).
888        UniqueLinesCaseInsensitive,
889        /// Removes duplicate lines (case-sensitive).
890        UniqueLinesCaseSensitive,
891        /// Removes the surrounding syntax node (for example brackets, or closures)
892        /// from the current selections.
893        UnwrapSyntaxNode,
894        /// Wraps selections in tag specified by language.
895        WrapSelectionsInTag,
896        /// Aligns selections from different rows into the same column
897        AlignSelections,
898    ]
899);
900
901/// Finds all references to the symbol at cursor.
902#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
903#[action(namespace = editor)]
904#[serde(deny_unknown_fields)]
905pub struct FindAllReferences {
906    #[serde(default = "default_true")]
907    pub always_open_multibuffer: bool,
908}
909
910impl Default for FindAllReferences {
911    fn default() -> Self {
912        Self {
913            always_open_multibuffer: true,
914        }
915    }
916}
917
918/// Edits a stored review comment inline.
919#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
920#[action(namespace = editor)]
921#[serde(deny_unknown_fields)]
922pub struct EditReviewComment {
923    pub id: usize,
924}
925
926/// Deletes a stored review comment.
927#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
928#[action(namespace = editor)]
929#[serde(deny_unknown_fields)]
930pub struct DeleteReviewComment {
931    pub id: usize,
932}
933
934/// Confirms an inline edit of a review comment.
935#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
936#[action(namespace = editor)]
937#[serde(deny_unknown_fields)]
938pub struct ConfirmEditReviewComment {
939    pub id: usize,
940}
941
942/// Cancels an inline edit of a review comment.
943#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
944#[action(namespace = editor)]
945#[serde(deny_unknown_fields)]
946pub struct CancelEditReviewComment {
947    pub id: usize,
948}