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