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/// Moves the cursor up by a specified number of lines.
154#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
155#[action(namespace = editor)]
156#[serde(deny_unknown_fields)]
157pub struct MoveUpByLines {
158    #[serde(default)]
159    pub(super) lines: u32,
160}
161
162/// Moves the cursor down by a specified number of lines.
163#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
164#[action(namespace = editor)]
165#[serde(deny_unknown_fields)]
166pub struct MoveDownByLines {
167    #[serde(default)]
168    pub(super) lines: u32,
169}
170
171/// Extends selection up by a specified number of lines.
172#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
173#[action(namespace = editor)]
174#[serde(deny_unknown_fields)]
175pub struct SelectUpByLines {
176    #[serde(default)]
177    pub(super) lines: u32,
178}
179
180/// Extends selection down by a specified number of lines.
181#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
182#[action(namespace = editor)]
183#[serde(deny_unknown_fields)]
184pub struct SelectDownByLines {
185    #[serde(default)]
186    pub(super) lines: u32,
187}
188
189/// Expands all excerpts in the editor.
190#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
191#[action(namespace = editor)]
192#[serde(deny_unknown_fields)]
193pub struct ExpandExcerpts {
194    #[serde(default)]
195    pub(super) lines: u32,
196}
197
198/// Expands excerpts above the current position.
199#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
200#[action(namespace = editor)]
201#[serde(deny_unknown_fields)]
202pub struct ExpandExcerptsUp {
203    #[serde(default)]
204    pub(super) lines: u32,
205}
206
207/// Expands excerpts below the current position.
208#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
209#[action(namespace = editor)]
210#[serde(deny_unknown_fields)]
211pub struct ExpandExcerptsDown {
212    #[serde(default)]
213    pub(super) lines: u32,
214}
215
216/// Handles text input in the editor.
217#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
218#[action(namespace = editor)]
219pub struct HandleInput(pub String);
220
221/// Deletes from the cursor to the end of the next word.
222/// Stops before the end of the next word, if whitespace sequences of length >= 2 are encountered.
223#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
224#[action(namespace = editor)]
225#[serde(deny_unknown_fields)]
226pub struct DeleteToNextWordEnd {
227    #[serde(default)]
228    pub ignore_newlines: bool,
229    // Whether to stop before the end of the next word, if language-defined bracket is encountered.
230    #[serde(default)]
231    pub ignore_brackets: bool,
232}
233
234/// Deletes from the cursor to the start of the previous word.
235/// Stops before the start of the previous word, if whitespace sequences of length >= 2 are encountered.
236#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
237#[action(namespace = editor)]
238#[serde(deny_unknown_fields)]
239pub struct DeleteToPreviousWordStart {
240    #[serde(default)]
241    pub ignore_newlines: bool,
242    // Whether to stop before the start of the previous word, if language-defined bracket is encountered.
243    #[serde(default)]
244    pub ignore_brackets: bool,
245}
246
247/// Cuts from cursor to end of line.
248#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
249#[action(namespace = editor)]
250#[serde(deny_unknown_fields)]
251pub struct CutToEndOfLine {
252    #[serde(default)]
253    pub stop_at_newlines: bool,
254}
255
256/// Folds all code blocks at the specified indentation level.
257#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
258#[action(namespace = editor)]
259pub struct FoldAtLevel(pub u32);
260
261/// Spawns the nearest available task from the current cursor position.
262#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
263#[action(namespace = editor)]
264#[serde(deny_unknown_fields)]
265pub struct SpawnNearestTask {
266    #[serde(default)]
267    pub reveal: task::RevealStrategy,
268}
269
270#[derive(Clone, PartialEq, Action)]
271#[action(no_json, no_register)]
272pub struct DiffClipboardWithSelectionData {
273    pub clipboard_text: String,
274    pub editor: Entity<Editor>,
275}
276
277#[derive(Debug, PartialEq, Eq, Clone, Copy, Deserialize, Default)]
278pub enum UuidVersion {
279    #[default]
280    V4,
281    V7,
282}
283
284/// Splits selection into individual lines.
285#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
286#[action(namespace = editor)]
287#[serde(deny_unknown_fields)]
288pub struct SplitSelectionIntoLines {
289    /// Keep the text selected after splitting instead of collapsing to cursors.
290    #[serde(default)]
291    pub keep_selections: bool,
292}
293
294/// Goes to the next diagnostic in the file.
295#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
296#[action(namespace = editor)]
297#[serde(deny_unknown_fields)]
298pub struct GoToDiagnostic {
299    #[serde(default)]
300    pub severity: GoToDiagnosticSeverityFilter,
301}
302
303/// Goes to the previous diagnostic in the file.
304#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
305#[action(namespace = editor)]
306#[serde(deny_unknown_fields)]
307pub struct GoToPreviousDiagnostic {
308    #[serde(default)]
309    pub severity: GoToDiagnosticSeverityFilter,
310}
311
312/// Adds a cursor above the current selection.
313#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
314#[action(namespace = editor)]
315#[serde(deny_unknown_fields)]
316pub struct AddSelectionAbove {
317    #[serde(default = "default_true")]
318    pub skip_soft_wrap: bool,
319}
320
321/// Adds a cursor below the current selection.
322#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
323#[action(namespace = editor)]
324#[serde(deny_unknown_fields)]
325pub struct AddSelectionBelow {
326    #[serde(default = "default_true")]
327    pub skip_soft_wrap: bool,
328}
329
330/// Inserts a snippet at the cursor.
331#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
332#[action(namespace = editor)]
333#[serde(deny_unknown_fields)]
334pub struct InsertSnippet {
335    /// Language name if using a named snippet, or `None` for a global snippet
336    ///
337    /// This is typically lowercase and matches the filename containing the snippet, without the `.json` extension.
338    pub language: Option<String>,
339    /// Name if using a named snippet
340    pub name: Option<String>,
341
342    /// Snippet body, if not using a named snippet
343    // todo(andrew): use `ListOrDirect` or similar for multiline snippet body
344    pub snippet: Option<String>,
345}
346
347actions!(
348    debugger,
349    [
350        /// Runs program execution to the current cursor position.
351        RunToCursor,
352        /// Evaluates the selected text in the debugger context.
353        EvaluateSelectedText
354    ]
355);
356
357actions!(
358    go_to_line,
359    [
360        /// Toggles the go to line dialog.
361        #[action(name = "Toggle")]
362        ToggleGoToLine
363    ]
364);
365
366actions!(
367    editor,
368    [
369        /// Accepts the full edit prediction.
370        AcceptEditPrediction,
371        /// Accepts a partial edit prediction.
372        #[action(deprecated_aliases = ["editor::AcceptPartialCopilotSuggestion"])]
373        AcceptNextWordEditPrediction,
374        AcceptNextLineEditPrediction,
375        /// Applies all diff hunks in the editor.
376        ApplyAllDiffHunks,
377        /// Applies the diff hunk at the current position.
378        ApplyDiffHunk,
379        /// Deletes the character before the cursor.
380        Backspace,
381        /// Shows git blame information for the current line.
382        BlameHover,
383        /// Cancels the current operation.
384        Cancel,
385        /// Cancels the running flycheck operation.
386        CancelFlycheck,
387        /// Cancels pending language server work.
388        CancelLanguageServerWork,
389        /// Clears flycheck results.
390        ClearFlycheck,
391        /// Confirms the rename operation.
392        ConfirmRename,
393        /// Confirms completion by inserting at cursor.
394        ConfirmCompletionInsert,
395        /// Confirms completion by replacing existing text.
396        ConfirmCompletionReplace,
397        /// Navigates to the first item in the context menu.
398        ContextMenuFirst,
399        /// Navigates to the last item in the context menu.
400        ContextMenuLast,
401        /// Navigates to the next item in the context menu.
402        ContextMenuNext,
403        /// Navigates to the previous item in the context menu.
404        ContextMenuPrevious,
405        /// Converts indentation from tabs to spaces.
406        ConvertIndentationToSpaces,
407        /// Converts indentation from spaces to tabs.
408        ConvertIndentationToTabs,
409        /// Converts selected text to kebab-case.
410        ConvertToKebabCase,
411        /// Converts selected text to lowerCamelCase.
412        ConvertToLowerCamelCase,
413        /// Converts selected text to lowercase.
414        ConvertToLowerCase,
415        /// Toggles the case of selected text.
416        ConvertToOppositeCase,
417        /// Converts selected text to sentence case.
418        ConvertToSentenceCase,
419        /// Converts selected text to snake_case.
420        ConvertToSnakeCase,
421        /// Converts selected text to Title Case.
422        ConvertToTitleCase,
423        /// Converts selected text to UpperCamelCase.
424        ConvertToUpperCamelCase,
425        /// Converts selected text to UPPERCASE.
426        ConvertToUpperCase,
427        /// Applies ROT13 cipher to selected text.
428        ConvertToRot13,
429        /// Applies ROT47 cipher to selected text.
430        ConvertToRot47,
431        /// Copies selected text to the clipboard.
432        Copy,
433        /// Copies selected text to the clipboard with leading/trailing whitespace trimmed.
434        CopyAndTrim,
435        /// Copies the current file location to the clipboard.
436        CopyFileLocation,
437        /// Copies the highlighted text as JSON.
438        CopyHighlightJson,
439        /// Copies the current file name to the clipboard.
440        CopyFileName,
441        /// Copies the file name without extension to the clipboard.
442        CopyFileNameWithoutExtension,
443        /// Copies a permalink to the current line.
444        CopyPermalinkToLine,
445        /// Cuts selected text to the clipboard.
446        Cut,
447        /// Deletes the character after the cursor.
448        Delete,
449        /// Deletes the current line.
450        DeleteLine,
451        /// Deletes from cursor to end of line.
452        DeleteToEndOfLine,
453        /// Deletes to the end of the next subword.
454        DeleteToNextSubwordEnd,
455        /// Deletes to the start of the previous subword.
456        DeleteToPreviousSubwordStart,
457        /// Diffs the text stored in the clipboard against the current selection.
458        DiffClipboardWithSelection,
459        /// Displays names of all active cursors.
460        DisplayCursorNames,
461        /// Duplicates the current line below.
462        DuplicateLineDown,
463        /// Duplicates the current line above.
464        DuplicateLineUp,
465        /// Duplicates the current selection.
466        DuplicateSelection,
467        /// Expands all diff hunks in the editor.
468        #[action(deprecated_aliases = ["editor::ExpandAllHunkDiffs"])]
469        ExpandAllDiffHunks,
470        /// Collapses all diff hunks in the editor.
471        CollapseAllDiffHunks,
472        /// Expands macros recursively at cursor position.
473        ExpandMacroRecursively,
474        /// Finds the next match in the search.
475        FindNextMatch,
476        /// Finds the previous match in the search.
477        FindPreviousMatch,
478        /// Folds the current code block.
479        Fold,
480        /// Folds all foldable regions in the editor.
481        FoldAll,
482        /// Folds all code blocks at indentation level 1.
483        #[action(name = "FoldAtLevel_1")]
484        FoldAtLevel1,
485        /// Folds all code blocks at indentation level 2.
486        #[action(name = "FoldAtLevel_2")]
487        FoldAtLevel2,
488        /// Folds all code blocks at indentation level 3.
489        #[action(name = "FoldAtLevel_3")]
490        FoldAtLevel3,
491        /// Folds all code blocks at indentation level 4.
492        #[action(name = "FoldAtLevel_4")]
493        FoldAtLevel4,
494        /// Folds all code blocks at indentation level 5.
495        #[action(name = "FoldAtLevel_5")]
496        FoldAtLevel5,
497        /// Folds all code blocks at indentation level 6.
498        #[action(name = "FoldAtLevel_6")]
499        FoldAtLevel6,
500        /// Folds all code blocks at indentation level 7.
501        #[action(name = "FoldAtLevel_7")]
502        FoldAtLevel7,
503        /// Folds all code blocks at indentation level 8.
504        #[action(name = "FoldAtLevel_8")]
505        FoldAtLevel8,
506        /// Folds all code blocks at indentation level 9.
507        #[action(name = "FoldAtLevel_9")]
508        FoldAtLevel9,
509        /// Folds all function bodies in the editor.
510        FoldFunctionBodies,
511        /// Folds the current code block and all its children.
512        FoldRecursive,
513        /// Folds the selected ranges.
514        FoldSelectedRanges,
515        /// Toggles focus back to the last active buffer.
516        ToggleFocus,
517        /// Toggles folding at the current position.
518        ToggleFold,
519        /// Toggles recursive folding at the current position.
520        ToggleFoldRecursive,
521        /// Toggles all folds in a buffer or all excerpts in multibuffer.
522        ToggleFoldAll,
523        /// Formats the entire document.
524        Format,
525        /// Formats only the selected text.
526        FormatSelections,
527        /// Goes to the declaration of the symbol at cursor.
528        GoToDeclaration,
529        /// Goes to declaration in a split pane.
530        GoToDeclarationSplit,
531        /// Goes to the definition of the symbol at cursor.
532        GoToDefinition,
533        /// Goes to definition in a split pane.
534        GoToDefinitionSplit,
535        /// Goes to the next diff hunk.
536        GoToHunk,
537        /// Goes to the previous diff hunk.
538        GoToPreviousHunk,
539        /// Goes to the implementation of the symbol at cursor.
540        GoToImplementation,
541        /// Goes to implementation in a split pane.
542        GoToImplementationSplit,
543        /// Goes to the next change in the file.
544        GoToNextChange,
545        /// Goes to the parent module of the current file.
546        GoToParentModule,
547        /// Goes to the previous change in the file.
548        GoToPreviousChange,
549        /// Goes to the next reference to the symbol under the cursor.
550        GoToNextReference,
551        /// Goes to the previous reference to the symbol under the cursor.
552        GoToPreviousReference,
553        /// Goes to the type definition of the symbol at cursor.
554        GoToTypeDefinition,
555        /// Goes to type definition in a split pane.
556        GoToTypeDefinitionSplit,
557        /// Goes to the next document highlight.
558        GoToNextDocumentHighlight,
559        /// Goes to the previous document highlight.
560        GoToPreviousDocumentHighlight,
561        /// Scrolls down by half a page.
562        HalfPageDown,
563        /// Scrolls up by half a page.
564        HalfPageUp,
565        /// Shows hover information for the symbol at cursor.
566        Hover,
567        /// Increases indentation of selected lines.
568        Indent,
569        /// Inserts a UUID v4 at cursor position.
570        InsertUuidV4,
571        /// Inserts a UUID v7 at cursor position.
572        InsertUuidV7,
573        /// Joins the current line with the next line.
574        JoinLines,
575        /// Cuts to kill ring (Emacs-style).
576        KillRingCut,
577        /// Yanks from kill ring (Emacs-style).
578        KillRingYank,
579        /// Moves cursor down one line.
580        LineDown,
581        /// Moves cursor up one line.
582        LineUp,
583        /// Moves cursor down.
584        MoveDown,
585        /// Moves cursor left.
586        MoveLeft,
587        /// Moves the current line down.
588        MoveLineDown,
589        /// Moves the current line up.
590        MoveLineUp,
591        /// Moves cursor right.
592        MoveRight,
593        /// Moves cursor to the beginning of the document.
594        MoveToBeginning,
595        /// Moves cursor to the enclosing bracket.
596        MoveToEnclosingBracket,
597        /// Moves cursor to the end of the document.
598        MoveToEnd,
599        /// Moves cursor to the end of the paragraph.
600        MoveToEndOfParagraph,
601        /// Moves cursor to the end of the next subword.
602        MoveToNextSubwordEnd,
603        /// Moves cursor to the end of the next word.
604        MoveToNextWordEnd,
605        /// Moves cursor to the start of the previous subword.
606        MoveToPreviousSubwordStart,
607        /// Moves cursor to the start of the previous word.
608        MoveToPreviousWordStart,
609        /// Moves cursor to the start of the paragraph.
610        MoveToStartOfParagraph,
611        /// Moves cursor to the start of the current excerpt.
612        MoveToStartOfExcerpt,
613        /// Moves cursor to the start of the next excerpt.
614        MoveToStartOfNextExcerpt,
615        /// Moves cursor to the end of the current excerpt.
616        MoveToEndOfExcerpt,
617        /// Moves cursor to the end of the previous excerpt.
618        MoveToEndOfPreviousExcerpt,
619        /// Moves cursor up.
620        MoveUp,
621        /// Inserts a new line and moves cursor to it.
622        Newline,
623        /// Inserts a new line above the current line.
624        NewlineAbove,
625        /// Inserts a new line below the current line.
626        NewlineBelow,
627        /// Navigates to the next edit prediction.
628        NextEditPrediction,
629        /// Scrolls to the next screen.
630        NextScreen,
631        /// Goes to the next snippet tabstop if one exists.
632        NextSnippetTabstop,
633        /// Opens the context menu at cursor position.
634        OpenContextMenu,
635        /// Opens excerpts from the current file.
636        OpenExcerpts,
637        /// Opens excerpts in a split pane.
638        OpenExcerptsSplit,
639        /// Opens the proposed changes editor.
640        OpenProposedChangesEditor,
641        /// Opens documentation for the symbol at cursor.
642        OpenDocs,
643        /// Opens a permalink to the current line.
644        OpenPermalinkToLine,
645        /// Opens the file whose name is selected in the editor.
646        #[action(deprecated_aliases = ["editor::OpenFile"])]
647        OpenSelectedFilename,
648        /// Opens all selections in a multibuffer.
649        OpenSelectionsInMultibuffer,
650        /// Opens the URL at cursor position.
651        OpenUrl,
652        /// Organizes import statements.
653        OrganizeImports,
654        /// Decreases indentation of selected lines.
655        Outdent,
656        /// Automatically adjusts indentation based on context.
657        AutoIndent,
658        /// Scrolls down by one page.
659        PageDown,
660        /// Scrolls up by one page.
661        PageUp,
662        /// Pastes from clipboard.
663        Paste,
664        /// Navigates to the previous edit prediction.
665        PreviousEditPrediction,
666        /// Goes to the previous snippet tabstop if one exists.
667        PreviousSnippetTabstop,
668        /// Redoes the last undone edit.
669        Redo,
670        /// Redoes the last selection change.
671        RedoSelection,
672        /// Renames the symbol at cursor.
673        Rename,
674        /// Restarts the language server for the current file.
675        RestartLanguageServer,
676        /// Reveals the current file in the system file manager.
677        RevealInFileManager,
678        /// Reverses the order of selected lines.
679        ReverseLines,
680        /// Reloads the file from disk.
681        ReloadFile,
682        /// Rewraps text to fit within the preferred line length.
683        Rewrap,
684        /// Rotates selections or lines backward.
685        RotateSelectionsBackward,
686        /// Rotates selections or lines forward.
687        RotateSelectionsForward,
688        /// Runs flycheck diagnostics.
689        RunFlycheck,
690        /// Scrolls the cursor to the bottom of the viewport.
691        ScrollCursorBottom,
692        /// Scrolls the cursor to the center of the viewport.
693        ScrollCursorCenter,
694        /// Cycles cursor position between center, top, and bottom.
695        ScrollCursorCenterTopBottom,
696        /// Scrolls the cursor to the top of the viewport.
697        ScrollCursorTop,
698        /// Selects all text in the editor.
699        SelectAll,
700        /// Selects all matches of the current selection.
701        SelectAllMatches,
702        /// Selects to the start of the current excerpt.
703        SelectToStartOfExcerpt,
704        /// Selects to the start of the next excerpt.
705        SelectToStartOfNextExcerpt,
706        /// Selects to the end of the current excerpt.
707        SelectToEndOfExcerpt,
708        /// Selects to the end of the previous excerpt.
709        SelectToEndOfPreviousExcerpt,
710        /// Extends selection down.
711        SelectDown,
712        /// Selects the enclosing symbol.
713        SelectEnclosingSymbol,
714        /// Selects the next larger syntax node.
715        SelectLargerSyntaxNode,
716        /// Selects the next syntax node sibling.
717        SelectNextSyntaxNode,
718        /// Selects the previous syntax node sibling.
719        SelectPreviousSyntaxNode,
720        /// Extends selection left.
721        SelectLeft,
722        /// Selects the current line.
723        SelectLine,
724        /// Extends selection down by one page.
725        SelectPageDown,
726        /// Extends selection up by one page.
727        SelectPageUp,
728        /// Extends selection right.
729        SelectRight,
730        /// Selects the next smaller syntax node.
731        SelectSmallerSyntaxNode,
732        /// Selects to the beginning of the document.
733        SelectToBeginning,
734        /// Selects to the end of the document.
735        SelectToEnd,
736        /// Selects to the end of the paragraph.
737        SelectToEndOfParagraph,
738        /// Selects to the end of the next subword.
739        SelectToNextSubwordEnd,
740        /// Selects to the end of the next word.
741        SelectToNextWordEnd,
742        /// Selects to the start of the previous subword.
743        SelectToPreviousSubwordStart,
744        /// Selects to the start of the previous word.
745        SelectToPreviousWordStart,
746        /// Selects to the start of the paragraph.
747        SelectToStartOfParagraph,
748        /// Extends selection up.
749        SelectUp,
750        /// Shows code completion suggestions at the cursor position.
751        ShowCompletions,
752        /// Shows the system character palette.
753        ShowCharacterPalette,
754        /// Shows edit prediction at cursor.
755        ShowEditPrediction,
756        /// Shows signature help for the current function.
757        ShowSignatureHelp,
758        /// Shows word completions.
759        ShowWordCompletions,
760        /// Randomly shuffles selected lines.
761        ShuffleLines,
762        /// Navigates to the next signature in the signature help popup.
763        SignatureHelpNext,
764        /// Navigates to the previous signature in the signature help popup.
765        SignatureHelpPrevious,
766        /// Sorts selected lines by length.
767        SortLinesByLength,
768        /// Sorts selected lines case-insensitively.
769        SortLinesCaseInsensitive,
770        /// Sorts selected lines case-sensitively.
771        SortLinesCaseSensitive,
772        /// Stops the language server for the current file.
773        StopLanguageServer,
774        /// Switches between source and header files.
775        SwitchSourceHeader,
776        /// Inserts a tab character or indents.
777        Tab,
778        /// Removes a tab character or outdents.
779        Backtab,
780        /// Toggles a breakpoint at the current line.
781        ToggleBreakpoint,
782        /// Toggles the case of selected text.
783        ToggleCase,
784        /// Disables the breakpoint at the current line.
785        DisableBreakpoint,
786        /// Enables the breakpoint at the current line.
787        EnableBreakpoint,
788        /// Edits the log message for a breakpoint.
789        EditLogBreakpoint,
790        /// Toggles automatic signature help.
791        ToggleAutoSignatureHelp,
792        /// Toggles inline git blame display.
793        ToggleGitBlameInline,
794        /// Opens the git commit for the blame at cursor.
795        OpenGitBlameCommit,
796        /// Toggles the diagnostics panel.
797        ToggleDiagnostics,
798        /// Toggles indent guides display.
799        ToggleIndentGuides,
800        /// Toggles inlay hints display.
801        ToggleInlayHints,
802        /// Toggles inline values display.
803        ToggleInlineValues,
804        /// Toggles inline diagnostics display.
805        ToggleInlineDiagnostics,
806        /// Toggles edit prediction feature.
807        ToggleEditPrediction,
808        /// Toggles line numbers display.
809        ToggleLineNumbers,
810        /// Toggles the minimap display.
811        ToggleMinimap,
812        /// Swaps the start and end of the current selection.
813        SwapSelectionEnds,
814        /// Sets a mark at the current position.
815        SetMark,
816        /// Toggles relative line numbers display.
817        ToggleRelativeLineNumbers,
818        /// Toggles diff display for selected hunks.
819        #[action(deprecated_aliases = ["editor::ToggleHunkDiff"])]
820        ToggleSelectedDiffHunks,
821        /// Toggles the selection menu.
822        ToggleSelectionMenu,
823        /// Toggles soft wrap mode.
824        ToggleSoftWrap,
825        /// Toggles the tab bar display.
826        ToggleTabBar,
827        /// Transposes characters around cursor.
828        Transpose,
829        /// Undoes the last edit.
830        Undo,
831        /// Undoes the last selection change.
832        UndoSelection,
833        /// Unfolds all folded regions.
834        UnfoldAll,
835        /// Unfolds lines at cursor.
836        UnfoldLines,
837        /// Unfolds recursively at cursor.
838        UnfoldRecursive,
839        /// Removes duplicate lines (case-insensitive).
840        UniqueLinesCaseInsensitive,
841        /// Removes duplicate lines (case-sensitive).
842        UniqueLinesCaseSensitive,
843        /// Removes the surrounding syntax node (for example brackets, or closures)
844        /// from the current selections.
845        UnwrapSyntaxNode,
846        /// Wraps selections in tag specified by language.
847        WrapSelectionsInTag
848    ]
849);
850
851/// Finds all references to the symbol at cursor.
852#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
853#[action(namespace = editor)]
854#[serde(deny_unknown_fields)]
855pub struct FindAllReferences {
856    #[serde(default = "default_true")]
857    pub always_open_multibuffer: bool,
858}
859
860impl Default for FindAllReferences {
861    fn default() -> Self {
862        Self {
863            always_open_multibuffer: true,
864        }
865    }
866}