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