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