lib.rs

  1use gpui::{Action, actions};
  2use schemars::JsonSchema;
  3use serde::{Deserialize, Serialize};
  4use std::path::PathBuf;
  5
  6// If the zed binary doesn't use anything in this crate, it will be optimized away
  7// and the actions won't initialize. So we just provide an empty initialization function
  8// to be called from main.
  9//
 10// These may provide relevant context:
 11// https://github.com/rust-lang/rust/issues/47384
 12// https://github.com/mmastrac/rust-ctor/issues/280
 13pub fn init() {}
 14
 15/// Opens a URL in the system's default web browser.
 16#[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
 17#[action(namespace = zed)]
 18#[serde(deny_unknown_fields)]
 19pub struct OpenBrowser {
 20    pub url: String,
 21}
 22
 23/// Opens a zed:// URL within the application.
 24#[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
 25#[action(namespace = zed)]
 26#[serde(deny_unknown_fields)]
 27pub struct OpenZedUrl {
 28    pub url: String,
 29}
 30
 31/// Opens the keymap to either add a keybinding or change an existing one
 32#[derive(PartialEq, Clone, Default, Action, JsonSchema, Serialize, Deserialize)]
 33#[action(namespace = zed, no_json, no_register)]
 34pub struct ChangeKeybinding {
 35    pub action: String,
 36}
 37
 38actions!(
 39    zed,
 40    [
 41        /// Opens the settings editor.
 42        #[action(deprecated_aliases = ["zed_actions::OpenSettingsEditor"])]
 43        OpenSettings,
 44        /// Opens the settings JSON file.
 45        #[action(deprecated_aliases = ["zed_actions::OpenSettings"])]
 46        OpenSettingsFile,
 47        /// Opens project-specific settings.
 48        #[action(deprecated_aliases = ["zed_actions::OpenProjectSettings"])]
 49        OpenProjectSettings,
 50        /// Opens the default keymap file.
 51        OpenDefaultKeymap,
 52        /// Opens the user keymap file.
 53        #[action(deprecated_aliases = ["zed_actions::OpenKeymap"])]
 54        OpenKeymapFile,
 55        /// Opens the keymap editor.
 56        #[action(deprecated_aliases = ["zed_actions::OpenKeymapEditor"])]
 57        OpenKeymap,
 58        /// Opens account settings.
 59        OpenAccountSettings,
 60        /// Opens server settings.
 61        OpenServerSettings,
 62        /// Quits the application.
 63        Quit,
 64        /// Shows information about Zed.
 65        About,
 66        /// Opens the documentation website.
 67        OpenDocs,
 68        /// Views open source licenses.
 69        OpenLicenses,
 70        /// Opens the telemetry log.
 71        OpenTelemetryLog,
 72        /// Opens the performance profiler.
 73        OpenPerformanceProfiler,
 74        /// Opens the onboarding view.
 75        OpenOnboarding,
 76        /// Shows the auto-update notification for testing.
 77        ShowUpdateNotification,
 78    ]
 79);
 80
 81#[derive(PartialEq, Clone, Copy, Debug, Deserialize, JsonSchema)]
 82#[serde(rename_all = "snake_case")]
 83pub enum ExtensionCategoryFilter {
 84    Themes,
 85    IconThemes,
 86    Languages,
 87    Grammars,
 88    LanguageServers,
 89    ContextServers,
 90    AgentServers,
 91    Snippets,
 92    DebugAdapters,
 93}
 94
 95/// Opens the extensions management interface.
 96#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
 97#[action(namespace = zed)]
 98#[serde(deny_unknown_fields)]
 99pub struct Extensions {
100    /// Filters the extensions page down to extensions that are in the specified category.
101    #[serde(default)]
102    pub category_filter: Option<ExtensionCategoryFilter>,
103    /// Focuses just the extension with the specified ID.
104    #[serde(default)]
105    pub id: Option<String>,
106}
107
108/// Opens the ACP registry.
109#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
110#[action(namespace = zed)]
111#[serde(deny_unknown_fields)]
112pub struct AcpRegistry;
113
114/// Show call diagnostics and connection quality statistics.
115#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
116#[action(namespace = collab)]
117#[serde(deny_unknown_fields)]
118pub struct ShowCallStats;
119
120/// Decreases the font size in the editor buffer.
121#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
122#[action(namespace = zed)]
123#[serde(deny_unknown_fields)]
124pub struct DecreaseBufferFontSize {
125    #[serde(default)]
126    pub persist: bool,
127}
128
129/// Increases the font size in the editor buffer.
130#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
131#[action(namespace = zed)]
132#[serde(deny_unknown_fields)]
133pub struct IncreaseBufferFontSize {
134    #[serde(default)]
135    pub persist: bool,
136}
137
138/// Opens the settings editor at a specific path.
139#[derive(PartialEq, Clone, Debug, Deserialize, JsonSchema, Action)]
140#[action(namespace = zed)]
141#[serde(deny_unknown_fields)]
142pub struct OpenSettingsAt {
143    /// A path to a specific setting (e.g. `theme.mode`)
144    pub path: String,
145}
146
147/// Resets the buffer font size to the default value.
148#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
149#[action(namespace = zed)]
150#[serde(deny_unknown_fields)]
151pub struct ResetBufferFontSize {
152    #[serde(default)]
153    pub persist: bool,
154}
155
156/// Decreases the font size of the user interface.
157#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
158#[action(namespace = zed)]
159#[serde(deny_unknown_fields)]
160pub struct DecreaseUiFontSize {
161    #[serde(default)]
162    pub persist: bool,
163}
164
165/// Increases the font size of the user interface.
166#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
167#[action(namespace = zed)]
168#[serde(deny_unknown_fields)]
169pub struct IncreaseUiFontSize {
170    #[serde(default)]
171    pub persist: bool,
172}
173
174/// Resets the UI font size to the default value.
175#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
176#[action(namespace = zed)]
177#[serde(deny_unknown_fields)]
178pub struct ResetUiFontSize {
179    #[serde(default)]
180    pub persist: bool,
181}
182
183/// Resets all zoom levels (UI and buffer font sizes, including in the agent panel) to their default values.
184#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
185#[action(namespace = zed)]
186#[serde(deny_unknown_fields)]
187pub struct ResetAllZoom {
188    #[serde(default)]
189    pub persist: bool,
190}
191
192pub mod editor {
193    use gpui::actions;
194    actions!(
195        editor,
196        [
197            /// Moves cursor up.
198            MoveUp,
199            /// Moves cursor down.
200            MoveDown,
201            /// Reveals the current file in the system file manager.
202            RevealInFileManager,
203        ]
204    );
205}
206
207pub mod dev {
208    use gpui::actions;
209
210    actions!(
211        dev,
212        [
213            /// Toggles the developer inspector for debugging UI elements.
214            ToggleInspector
215        ]
216    );
217}
218
219pub mod remote_debug {
220    use gpui::actions;
221
222    actions!(
223        remote_debug,
224        [
225            /// Simulates a disconnection from the remote server for testing purposes.
226            /// This will trigger the reconnection logic.
227            SimulateDisconnect,
228            /// Simulates a timeout/slow connection to the remote server for testing purposes.
229            /// This will cause heartbeat failures and trigger reconnection.
230            SimulateTimeout,
231            /// Simulates a timeout/slow connection to the remote server for testing purposes.
232            /// This will cause heartbeat failures and attempting a reconnection while having exhausted all attempts.
233            SimulateTimeoutExhausted,
234        ]
235    );
236}
237
238pub mod workspace {
239    use gpui::actions;
240
241    actions!(
242        workspace,
243        [
244            #[action(deprecated_aliases = ["editor::CopyPath", "outline_panel::CopyPath", "project_panel::CopyPath"])]
245            CopyPath,
246            #[action(deprecated_aliases = ["editor::CopyRelativePath", "outline_panel::CopyRelativePath", "project_panel::CopyRelativePath"])]
247            CopyRelativePath,
248            /// Opens the selected file with the system's default application.
249            #[action(deprecated_aliases = ["project_panel::OpenWithSystem"])]
250            OpenWithSystem,
251        ]
252    );
253}
254
255/// Describes which ref to base a new git worktree on. The worktree is
256/// always created in a detached HEAD state; users can opt into creating
257/// a branch afterwards from the worktree itself.
258#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
259#[serde(rename_all = "snake_case", tag = "kind")]
260pub enum NewWorktreeBranchTarget {
261    /// Create a detached worktree from the current HEAD.
262    #[default]
263    CurrentBranch,
264    /// Create a detached worktree at the tip of an existing branch.
265    ExistingBranch { name: String },
266}
267
268/// Creates a new git worktree and switches the workspace to it.
269/// Dispatched by the unified worktree picker when the user selects a "Create new worktree" entry.
270#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Action)]
271#[action(namespace = git)]
272#[serde(deny_unknown_fields)]
273pub struct CreateWorktree {
274    /// When this is None, Zed will randomly generate a worktree name.
275    pub worktree_name: Option<String>,
276    pub branch_target: NewWorktreeBranchTarget,
277}
278
279/// Switches the workspace to an existing linked worktree.
280/// Dispatched by the unified worktree picker when the user selects an existing worktree.
281#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Action)]
282#[action(namespace = git)]
283#[serde(deny_unknown_fields)]
284pub struct SwitchWorktree {
285    pub path: PathBuf,
286    pub display_name: String,
287}
288
289/// Opens an existing worktree in a new window.
290/// Dispatched by the worktree picker's "Open in New Window" button.
291#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Action)]
292#[action(namespace = git)]
293#[serde(deny_unknown_fields)]
294pub struct OpenWorktreeInNewWindow {
295    pub path: PathBuf,
296}
297
298pub mod git {
299    use gpui::actions;
300
301    actions!(
302        git,
303        [
304            /// Checks out a different git branch.
305            CheckoutBranch,
306            /// Switches to a different git branch.
307            Switch,
308            /// Selects a different repository.
309            SelectRepo,
310            /// Filter remotes.
311            FilterRemotes,
312            /// Create a git remote.
313            CreateRemote,
314            /// Opens the git branch selector.
315            #[action(deprecated_aliases = ["branches::OpenRecent"])]
316            Branch,
317            /// Opens the git stash selector.
318            ViewStash,
319            /// Opens the git worktree selector.
320            Worktree,
321            /// Creates a pull request for the current branch.
322            CreatePullRequest
323        ]
324    );
325}
326
327pub mod toast {
328    use gpui::actions;
329
330    actions!(
331        toast,
332        [
333            /// Runs the action associated with a toast notification.
334            RunAction
335        ]
336    );
337}
338
339pub mod command_palette {
340    use gpui::actions;
341
342    actions!(
343        command_palette,
344        [
345            /// Toggles the command palette.
346            Toggle,
347        ]
348    );
349}
350
351pub mod project_panel {
352    use gpui::actions;
353
354    actions!(
355        project_panel,
356        [
357            /// Toggles the project panel.
358            Toggle,
359            /// Toggles focus on the project panel.
360            ToggleFocus
361        ]
362    );
363}
364pub mod feedback {
365    use gpui::actions;
366
367    actions!(
368        feedback,
369        [
370            /// Opens email client to send feedback to Zed support.
371            EmailZed,
372            /// Opens the bug report form.
373            FileBugReport,
374            /// Opens the feature request form.
375            RequestFeature
376        ]
377    );
378}
379
380pub mod theme {
381    use gpui::actions;
382
383    actions!(theme, [ToggleMode]);
384}
385
386pub mod theme_selector {
387    use gpui::Action;
388    use schemars::JsonSchema;
389    use serde::Deserialize;
390
391    /// Toggles the theme selector interface.
392    #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
393    #[action(namespace = theme_selector)]
394    #[serde(deny_unknown_fields)]
395    pub struct Toggle {
396        /// A list of theme names to filter the theme selector down to.
397        pub themes_filter: Option<Vec<String>>,
398    }
399}
400
401pub mod icon_theme_selector {
402    use gpui::Action;
403    use schemars::JsonSchema;
404    use serde::Deserialize;
405
406    /// Toggles the icon theme selector interface.
407    #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
408    #[action(namespace = icon_theme_selector)]
409    #[serde(deny_unknown_fields)]
410    pub struct Toggle {
411        /// A list of icon theme names to filter the theme selector down to.
412        pub themes_filter: Option<Vec<String>>,
413    }
414}
415
416pub mod search {
417    use gpui::actions;
418    actions!(
419        search,
420        [
421            /// Toggles searching in ignored files.
422            ToggleIncludeIgnored
423        ]
424    );
425}
426pub mod buffer_search {
427    use gpui::{Action, actions};
428    use schemars::JsonSchema;
429    use serde::Deserialize;
430
431    /// Opens the buffer search interface with the specified configuration.
432    #[derive(PartialEq, Clone, Deserialize, JsonSchema, Action)]
433    #[action(namespace = buffer_search)]
434    #[serde(deny_unknown_fields)]
435    pub struct Deploy {
436        #[serde(default = "util::serde::default_true")]
437        pub focus: bool,
438        #[serde(default)]
439        pub replace_enabled: bool,
440        #[serde(default)]
441        pub selection_search_enabled: bool,
442    }
443
444    impl Deploy {
445        pub fn find() -> Self {
446            Self {
447                focus: true,
448                replace_enabled: false,
449                selection_search_enabled: false,
450            }
451        }
452
453        pub fn replace() -> Self {
454            Self {
455                focus: true,
456                replace_enabled: true,
457                selection_search_enabled: false,
458            }
459        }
460    }
461
462    actions!(
463        buffer_search,
464        [
465            /// Deploys the search and replace interface.
466            DeployReplace,
467            /// Dismisses the search bar.
468            Dismiss,
469            /// Focuses back on the editor.
470            FocusEditor,
471            /// Sets the search query to the current selection without opening the search bar or running a search.
472            UseSelectionForFind,
473        ]
474    );
475}
476pub mod settings_profile_selector {
477    use gpui::Action;
478    use schemars::JsonSchema;
479    use serde::Deserialize;
480
481    #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
482    #[action(namespace = settings_profile_selector)]
483    pub struct Toggle;
484}
485
486pub mod agent {
487    use gpui::{Action, SharedString, actions};
488    use schemars::JsonSchema;
489    use serde::Deserialize;
490
491    actions!(
492        agent,
493        [
494            /// Opens the agent settings panel.
495            #[action(deprecated_aliases = ["agent::OpenConfiguration"])]
496            OpenSettings,
497            /// Opens the agent onboarding modal.
498            OpenOnboardingModal,
499            /// Resets the agent onboarding state.
500            ResetOnboarding,
501            /// Starts a chat conversation with the agent.
502            Chat,
503            /// Toggles the language model selector dropdown.
504            #[action(deprecated_aliases = ["assistant::ToggleModelSelector", "assistant2::ToggleModelSelector"])]
505            ToggleModelSelector,
506            /// Triggers re-authentication on Gemini
507            ReauthenticateAgent,
508            /// Add the current selection as context for threads in the agent panel.
509            #[action(deprecated_aliases = ["assistant::QuoteSelection", "agent::QuoteSelection"])]
510            AddSelectionToThread,
511            /// Resets the agent panel zoom levels (agent UI and buffer font sizes).
512            ResetAgentZoom,
513            /// Pastes clipboard content without any formatting.
514            PasteRaw,
515        ]
516    );
517
518    /// Opens a new agent thread with the provided branch diff for review.
519    #[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
520    #[action(namespace = agent)]
521    #[serde(deny_unknown_fields)]
522    pub struct ReviewBranchDiff {
523        /// The full text of the diff to review.
524        pub diff_text: SharedString,
525        /// The base ref that the diff was computed against (e.g. "main").
526        pub base_ref: SharedString,
527    }
528
529    /// A single merge conflict region extracted from a file.
530    #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema)]
531    pub struct ConflictContent {
532        pub file_path: String,
533        pub conflict_text: String,
534        pub ours_branch_name: String,
535        pub theirs_branch_name: String,
536    }
537
538    /// Opens a new agent thread to resolve specific merge conflicts.
539    #[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
540    #[action(namespace = agent)]
541    #[serde(deny_unknown_fields)]
542    pub struct ResolveConflictsWithAgent {
543        /// Individual conflicts with their full text.
544        pub conflicts: Vec<ConflictContent>,
545    }
546
547    /// Opens a new agent thread to resolve merge conflicts in the given file paths.
548    #[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
549    #[action(namespace = agent)]
550    #[serde(deny_unknown_fields)]
551    pub struct ResolveConflictedFilesWithAgent {
552        /// File paths with unresolved conflicts (for project-wide resolution).
553        pub conflicted_file_paths: Vec<String>,
554    }
555}
556
557pub mod assistant {
558    use gpui::{Action, actions};
559    use schemars::JsonSchema;
560    use serde::Deserialize;
561    use uuid::Uuid;
562
563    actions!(
564        agent,
565        [
566            /// Toggles the agent panel.
567            Toggle,
568            #[action(deprecated_aliases = ["assistant::ToggleFocus"])]
569            ToggleFocus,
570            FocusAgent,
571        ]
572    );
573
574    /// Opens the rules library for managing agent rules and prompts.
575    #[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
576    #[action(namespace = agent, deprecated_aliases = ["assistant::OpenRulesLibrary", "assistant::DeployPromptLibrary"])]
577    #[serde(deny_unknown_fields)]
578    pub struct OpenRulesLibrary {
579        #[serde(skip)]
580        pub prompt_to_select: Option<Uuid>,
581    }
582
583    /// Deploys the assistant interface with the specified configuration.
584    #[derive(Clone, Default, Deserialize, PartialEq, JsonSchema, Action)]
585    #[action(namespace = assistant)]
586    #[serde(deny_unknown_fields)]
587    pub struct InlineAssist {
588        pub prompt: Option<String>,
589    }
590}
591
592/// Opens the recent projects interface.
593#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
594#[action(namespace = projects)]
595#[serde(deny_unknown_fields)]
596pub struct OpenRecent {
597    #[serde(default)]
598    pub create_new_window: bool,
599}
600
601/// Creates a project from a selected template.
602#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
603#[action(namespace = projects)]
604#[serde(deny_unknown_fields)]
605pub struct OpenRemote {
606    #[serde(default)]
607    pub from_existing_connection: bool,
608    #[serde(default)]
609    pub create_new_window: bool,
610}
611
612/// Opens the dev container connection modal.
613#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
614#[action(namespace = projects)]
615#[serde(deny_unknown_fields)]
616pub struct OpenDevContainer;
617
618/// Where to spawn the task in the UI.
619#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
620#[serde(rename_all = "snake_case")]
621pub enum RevealTarget {
622    /// In the central pane group, "main" editor area.
623    Center,
624    /// In the terminal dock, "regular" terminal items' place.
625    #[default]
626    Dock,
627}
628
629/// Spawns a task with name or opens tasks modal.
630#[derive(Debug, PartialEq, Clone, Deserialize, JsonSchema, Action)]
631#[action(namespace = task)]
632#[serde(untagged)]
633pub enum Spawn {
634    /// Spawns a task by the name given.
635    ByName {
636        task_name: String,
637        #[serde(default)]
638        reveal_target: Option<RevealTarget>,
639    },
640    /// Spawns a task by the tag given.
641    ByTag {
642        task_tag: String,
643        #[serde(default)]
644        reveal_target: Option<RevealTarget>,
645    },
646    /// Spawns a task via modal's selection.
647    ViaModal {
648        /// Selected task's `reveal_target` property override.
649        #[serde(default)]
650        reveal_target: Option<RevealTarget>,
651    },
652}
653
654impl Spawn {
655    pub fn modal() -> Self {
656        Self::ViaModal {
657            reveal_target: None,
658        }
659    }
660}
661
662/// Reruns the last task.
663#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
664#[action(namespace = task)]
665#[serde(deny_unknown_fields)]
666pub struct Rerun {
667    /// Controls whether the task context is reevaluated prior to execution of a task.
668    /// If it is not, environment variables such as ZED_COLUMN, ZED_FILE are gonna be the same as in the last execution of a task
669    /// If it is, these variables will be updated to reflect current state of editor at the time task::Rerun is executed.
670    /// default: false
671    #[serde(default)]
672    pub reevaluate_context: bool,
673    /// Overrides `allow_concurrent_runs` property of the task being reran.
674    /// Default: null
675    #[serde(default)]
676    pub allow_concurrent_runs: Option<bool>,
677    /// Overrides `use_new_terminal` property of the task being reran.
678    /// Default: null
679    #[serde(default)]
680    pub use_new_terminal: Option<bool>,
681
682    /// If present, rerun the task with this ID, otherwise rerun the last task.
683    #[serde(skip)]
684    pub task_id: Option<String>,
685}
686
687pub mod outline {
688    use std::sync::OnceLock;
689
690    use gpui::{AnyView, App, Window, actions};
691
692    actions!(
693        outline,
694        [
695            #[action(name = "Toggle")]
696            ToggleOutline
697        ]
698    );
699    /// A pointer to outline::toggle function, exposed here to sewer the breadcrumbs <-> outline dependency.
700    pub static TOGGLE_OUTLINE: OnceLock<fn(AnyView, &mut Window, &mut App)> = OnceLock::new();
701}
702
703actions!(
704    zed_predict_onboarding,
705    [
706        /// Opens the Zed Predict onboarding modal.
707        OpenZedPredictOnboarding
708    ]
709);
710actions!(
711    git_onboarding,
712    [
713        /// Opens the git integration onboarding modal.
714        OpenGitIntegrationOnboarding
715    ]
716);
717
718pub mod debug_panel {
719    use gpui::actions;
720    actions!(
721        debug_panel,
722        [
723            /// Toggles the debug panel.
724            Toggle,
725            /// Toggles focus on the debug panel.
726            ToggleFocus
727        ]
728    );
729}
730
731actions!(
732    debugger,
733    [
734        /// Toggles the enabled state of a breakpoint.
735        ToggleEnableBreakpoint,
736        /// Removes a breakpoint.
737        UnsetBreakpoint,
738        /// Opens the project debug tasks configuration.
739        OpenProjectDebugTasks,
740    ]
741);
742
743pub mod vim {
744    use gpui::actions;
745
746    actions!(
747        vim,
748        [
749            /// Opens the default keymap file.
750            OpenDefaultKeymap
751        ]
752    );
753}
754
755#[derive(Debug, Clone, PartialEq, Eq, Hash)]
756pub struct WslConnectionOptions {
757    pub distro_name: String,
758    pub user: Option<String>,
759}
760
761#[cfg(target_os = "windows")]
762pub mod wsl_actions {
763    use gpui::Action;
764    use schemars::JsonSchema;
765    use serde::Deserialize;
766
767    /// Opens a folder inside Wsl.
768    #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
769    #[action(namespace = projects)]
770    #[serde(deny_unknown_fields)]
771    pub struct OpenFolderInWsl {
772        #[serde(default)]
773        pub create_new_window: bool,
774    }
775
776    /// Open a wsl distro.
777    #[derive(PartialEq, Clone, Deserialize, Default, JsonSchema, Action)]
778    #[action(namespace = projects)]
779    #[serde(deny_unknown_fields)]
780    pub struct OpenWsl {
781        #[serde(default)]
782        pub create_new_window: bool,
783    }
784}
785
786pub mod preview {
787    pub mod markdown {
788        use gpui::actions;
789
790        actions!(
791            markdown,
792            [
793                /// Opens a markdown preview for the current file.
794                OpenPreview,
795                /// Opens a markdown preview in a split pane.
796                OpenPreviewToTheSide,
797            ]
798        );
799    }
800
801    pub mod svg {
802        use gpui::actions;
803
804        actions!(
805            svg,
806            [
807                /// Opens an SVG preview for the current file.
808                OpenPreview,
809                /// Opens an SVG preview in a split pane.
810                OpenPreviewToTheSide,
811            ]
812        );
813    }
814}
815
816pub mod agents_sidebar {
817    use gpui::{Action, actions};
818    use schemars::JsonSchema;
819    use serde::Deserialize;
820
821    /// Toggles the thread switcher popup when the sidebar is focused.
822    #[derive(PartialEq, Clone, Deserialize, JsonSchema, Default, Action)]
823    #[action(namespace = agents_sidebar)]
824    #[serde(deny_unknown_fields)]
825    pub struct ToggleThreadSwitcher {
826        #[serde(default)]
827        pub select_last: bool,
828    }
829
830    actions!(
831        agents_sidebar,
832        [
833            /// Moves focus to the sidebar's search/filter editor.
834            FocusSidebarFilter,
835        ]
836    );
837}
838
839pub mod notebook {
840    use gpui::actions;
841
842    actions!(
843        notebook,
844        [
845            /// Opens a Jupyter notebook file.
846            OpenNotebook,
847            /// Runs all cells in the notebook.
848            RunAll,
849            /// Runs the current cell and stays on it.
850            Run,
851            /// Runs the current cell and advances to the next cell.
852            RunAndAdvance,
853            /// Clears all cell outputs.
854            ClearOutputs,
855            /// Moves the current cell up.
856            MoveCellUp,
857            /// Moves the current cell down.
858            MoveCellDown,
859            /// Adds a new markdown cell.
860            AddMarkdownBlock,
861            /// Adds a new code cell.
862            AddCodeBlock,
863            /// Restarts the kernel.
864            RestartKernel,
865            /// Interrupts the current execution.
866            InterruptKernel,
867            /// Move down in cells.
868            NotebookMoveDown,
869            /// Move up in cells.
870            NotebookMoveUp,
871            /// Enters the current cell's editor (edit mode).
872            EnterEditMode,
873            /// Exits the cell editor and returns to cell command mode.
874            EnterCommandMode,
875        ]
876    );
877}