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 to the start of the next larger syntax node.
642 MoveToStartOfLargerSyntaxNode,
643 /// Moves cursor to the end of the next larger syntax node.
644 MoveToEndOfLargerSyntaxNode,
645 /// Moves cursor up.
646 MoveUp,
647 /// Inserts a new line and moves cursor to it.
648 Newline,
649 /// Inserts a new line above the current line.
650 NewlineAbove,
651 /// Inserts a new line below the current line.
652 NewlineBelow,
653 /// Navigates to the next edit prediction.
654 NextEditPrediction,
655 /// Scrolls to the next screen.
656 NextScreen,
657 /// Goes to the next snippet tabstop if one exists.
658 NextSnippetTabstop,
659 /// Opens the context menu at cursor position.
660 OpenContextMenu,
661 /// Opens excerpts from the current file.
662 OpenExcerpts,
663 /// Opens excerpts in a split pane.
664 OpenExcerptsSplit,
665 /// Opens the proposed changes editor.
666 OpenProposedChangesEditor,
667 /// Opens documentation for the symbol at cursor.
668 OpenDocs,
669 /// Opens a permalink to the current line.
670 OpenPermalinkToLine,
671 /// Opens the file whose name is selected in the editor.
672 #[action(deprecated_aliases = ["editor::OpenFile"])]
673 OpenSelectedFilename,
674 /// Opens all selections in a multibuffer.
675 OpenSelectionsInMultibuffer,
676 /// Opens the URL at cursor position.
677 OpenUrl,
678 /// Organizes import statements.
679 OrganizeImports,
680 /// Decreases indentation of selected lines.
681 Outdent,
682 /// Automatically adjusts indentation based on context.
683 AutoIndent,
684 /// Scrolls down by one page.
685 PageDown,
686 /// Scrolls up by one page.
687 PageUp,
688 /// Pastes from clipboard.
689 Paste,
690 /// Navigates to the previous edit prediction.
691 PreviousEditPrediction,
692 /// Goes to the previous snippet tabstop if one exists.
693 PreviousSnippetTabstop,
694 /// Redoes the last undone edit.
695 Redo,
696 /// Redoes the last selection change.
697 RedoSelection,
698 /// Renames the symbol at cursor.
699 Rename,
700 /// Restarts the language server for the current file.
701 RestartLanguageServer,
702 /// Reveals the current file in the system file manager.
703 RevealInFileManager,
704 /// Reverses the order of selected lines.
705 ReverseLines,
706 /// Reloads the file from disk.
707 ReloadFile,
708 /// Rewraps text to fit within the preferred line length.
709 Rewrap,
710 /// Rotates selections or lines backward.
711 RotateSelectionsBackward,
712 /// Rotates selections or lines forward.
713 RotateSelectionsForward,
714 /// Runs flycheck diagnostics.
715 RunFlycheck,
716 /// Scrolls the cursor to the bottom of the viewport.
717 ScrollCursorBottom,
718 /// Scrolls the cursor to the center of the viewport.
719 ScrollCursorCenter,
720 /// Cycles cursor position between center, top, and bottom.
721 ScrollCursorCenterTopBottom,
722 /// Scrolls the cursor to the top of the viewport.
723 ScrollCursorTop,
724 /// Selects all text in the editor.
725 SelectAll,
726 /// Selects all matches of the current selection.
727 SelectAllMatches,
728 /// Selects to the start of the current excerpt.
729 SelectToStartOfExcerpt,
730 /// Selects to the start of the next excerpt.
731 SelectToStartOfNextExcerpt,
732 /// Selects to the end of the current excerpt.
733 SelectToEndOfExcerpt,
734 /// Selects to the end of the previous excerpt.
735 SelectToEndOfPreviousExcerpt,
736 /// Extends selection down.
737 SelectDown,
738 /// Selects the enclosing symbol.
739 SelectEnclosingSymbol,
740 /// Selects the next larger syntax node.
741 SelectLargerSyntaxNode,
742 /// Selects the next syntax node sibling.
743 SelectNextSyntaxNode,
744 /// Selects the previous syntax node sibling.
745 SelectPreviousSyntaxNode,
746 /// Extends selection left.
747 SelectLeft,
748 /// Selects the current line.
749 SelectLine,
750 /// Extends selection down by one page.
751 SelectPageDown,
752 /// Extends selection up by one page.
753 SelectPageUp,
754 /// Extends selection right.
755 SelectRight,
756 /// Selects the next smaller syntax node.
757 SelectSmallerSyntaxNode,
758 /// Selects to the beginning of the document.
759 SelectToBeginning,
760 /// Selects to the end of the document.
761 SelectToEnd,
762 /// Selects to the end of the paragraph.
763 SelectToEndOfParagraph,
764 /// Selects to the end of the next subword.
765 SelectToNextSubwordEnd,
766 /// Selects to the end of the next word.
767 SelectToNextWordEnd,
768 /// Selects to the start of the previous subword.
769 SelectToPreviousSubwordStart,
770 /// Selects to the start of the previous word.
771 SelectToPreviousWordStart,
772 /// Selects to the start of the paragraph.
773 SelectToStartOfParagraph,
774 /// Extends selection up.
775 SelectUp,
776 /// Shows code completion suggestions at the cursor position.
777 ShowCompletions,
778 /// Shows the system character palette.
779 ShowCharacterPalette,
780 /// Shows edit prediction at cursor.
781 ShowEditPrediction,
782 /// Shows signature help for the current function.
783 ShowSignatureHelp,
784 /// Shows word completions.
785 ShowWordCompletions,
786 /// Randomly shuffles selected lines.
787 ShuffleLines,
788 /// Navigates to the next signature in the signature help popup.
789 SignatureHelpNext,
790 /// Navigates to the previous signature in the signature help popup.
791 SignatureHelpPrevious,
792 /// Sorts selected lines by length.
793 SortLinesByLength,
794 /// Sorts selected lines case-insensitively.
795 SortLinesCaseInsensitive,
796 /// Sorts selected lines case-sensitively.
797 SortLinesCaseSensitive,
798 /// Stops the language server for the current file.
799 StopLanguageServer,
800 /// Switches between source and header files.
801 SwitchSourceHeader,
802 /// Inserts a tab character or indents.
803 Tab,
804 /// Removes a tab character or outdents.
805 Backtab,
806 /// Toggles a breakpoint at the current line.
807 ToggleBreakpoint,
808 /// Toggles the case of selected text.
809 ToggleCase,
810 /// Disables the breakpoint at the current line.
811 DisableBreakpoint,
812 /// Enables the breakpoint at the current line.
813 EnableBreakpoint,
814 /// Edits the log message for a breakpoint.
815 EditLogBreakpoint,
816 /// Toggles automatic signature help.
817 ToggleAutoSignatureHelp,
818 /// Toggles inline git blame display.
819 ToggleGitBlameInline,
820 /// Opens the git commit for the blame at cursor.
821 OpenGitBlameCommit,
822 /// Toggles the diagnostics panel.
823 ToggleDiagnostics,
824 /// Toggles indent guides display.
825 ToggleIndentGuides,
826 /// Toggles inlay hints display.
827 ToggleInlayHints,
828 /// Toggles inline values display.
829 ToggleInlineValues,
830 /// Toggles inline diagnostics display.
831 ToggleInlineDiagnostics,
832 /// Toggles edit prediction feature.
833 ToggleEditPrediction,
834 /// Toggles line numbers display.
835 ToggleLineNumbers,
836 /// Toggles the minimap display.
837 ToggleMinimap,
838 /// Swaps the start and end of the current selection.
839 SwapSelectionEnds,
840 /// Sets a mark at the current position.
841 SetMark,
842 /// Toggles relative line numbers display.
843 ToggleRelativeLineNumbers,
844 /// Toggles diff display for selected hunks.
845 #[action(deprecated_aliases = ["editor::ToggleHunkDiff"])]
846 ToggleSelectedDiffHunks,
847 /// Toggles the selection menu.
848 ToggleSelectionMenu,
849 /// Toggles soft wrap mode.
850 ToggleSoftWrap,
851 /// Toggles the tab bar display.
852 ToggleTabBar,
853 /// Transposes characters around cursor.
854 Transpose,
855 /// Undoes the last edit.
856 Undo,
857 /// Undoes the last selection change.
858 UndoSelection,
859 /// Unfolds all folded regions.
860 UnfoldAll,
861 /// Unfolds lines at cursor.
862 UnfoldLines,
863 /// Unfolds recursively at cursor.
864 UnfoldRecursive,
865 /// Removes duplicate lines (case-insensitive).
866 UniqueLinesCaseInsensitive,
867 /// Removes duplicate lines (case-sensitive).
868 UniqueLinesCaseSensitive,
869 /// Removes the surrounding syntax node (for example brackets, or closures)
870 /// from the current selections.
871 UnwrapSyntaxNode,
872 /// Wraps selections in tag specified by language.
873 WrapSelectionsInTag,
874 ]
875);
876
877/// Finds all references to the symbol at cursor.
878#[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
879#[action(namespace = editor)]
880#[serde(deny_unknown_fields)]
881pub struct FindAllReferences {
882 #[serde(default = "default_true")]
883 pub always_open_multibuffer: bool,
884}
885
886impl Default for FindAllReferences {
887 fn default() -> Self {
888 Self {
889 always_open_multibuffer: true,
890 }
891 }
892}