Restore namespace parameter to actions! (#3577)

This does not yet fix `derive(Action)`, but will conflict with a lot so
wanted to merge quickly.

Although automatically deriving the namespace worked in many situations,
it was
unclear what to do with nested modules. Vim wanted all actions to be
registered
under vim, while collab_ui wanted one namespace per action.

It seems better to make the implicit explicit, and give the flexibility
to hide
implementation details from the end-users.

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2023-12-09 15:27:17 -07:00 committed by GitHub
commit 62d6a85a71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 399 additions and 304 deletions

View file

@ -14,7 +14,7 @@ use ui::h_stack;
use util::ResultExt;
use workspace::{item::ItemHandle, StatusItemView, Workspace};
actions!(ShowErrorMessage);
actions!(activity_indicator, [ShowErrorMessage]);
const DOWNLOAD_ICON: &str = "icons/download.svg";
const WARNING_ICON: &str = "icons/warning.svg";

View file

@ -19,16 +19,19 @@ use std::{cmp::Reverse, ffi::OsStr, path::PathBuf, sync::Arc};
use util::paths::CONVERSATIONS_DIR;
actions!(
NewConversation,
Assist,
Split,
CycleMessageRole,
QuoteSelection,
ToggleFocus,
ResetKey,
InlineAssist,
ToggleIncludeConversation,
ToggleRetrieveContext,
assistant,
[
NewConversation,
Assist,
Split,
CycleMessageRole,
QuoteSelection,
ToggleFocus,
ResetKey,
InlineAssist,
ToggleIncludeConversation,
ToggleRetrieveContext,
]
);
#[derive(

View file

@ -26,10 +26,13 @@ const POLL_INTERVAL: Duration = Duration::from_secs(60 * 60);
//todo!(remove CheckThatAutoUpdaterWorks)
actions!(
Check,
DismissErrorMessage,
ViewReleaseNotes,
CheckThatAutoUpdaterWorks
auto_update,
[
Check,
DismissErrorMessage,
ViewReleaseNotes,
CheckThatAutoUpdaterWorks
]
);
#[derive(Serialize)]

View file

@ -70,7 +70,7 @@ pub const ZED_SECRET_CLIENT_TOKEN: &str = "618033988749894";
pub const INITIAL_RECONNECTION_DELAY: Duration = Duration::from_millis(100);
pub const CONNECTION_TIMEOUT: Duration = Duration::from_secs(5);
actions!(SignIn, SignOut, Reconnect);
actions!(client, [SignIn, SignOut, Reconnect]);
pub fn init_settings(cx: &mut AppContext) {
TelemetrySettings::register(cx);

View file

@ -26,7 +26,7 @@ use workspace::{
ItemNavHistory, Pane, SaveIntent, ViewId, Workspace, WorkspaceId,
};
actions!(Deploy);
actions!(collab, [Deploy]);
pub fn init(cx: &mut AppContext) {
register_followable_item::<ChannelView>(cx)

View file

@ -75,7 +75,7 @@ pub enum Event {
Dismissed,
}
actions!(ToggleFocus);
actions!(chat_panel, [ToggleFocus]);
impl ChatPanel {
pub fn new(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) -> View<Self> {

View file

@ -123,14 +123,17 @@ pub struct OpenChannelNotes {
// }
actions!(
ToggleFocus,
Remove,
Secondary,
CollapseSelectedChannel,
ExpandSelectedChannel,
StartMoveChannel,
MoveSelected,
InsertSpace,
collab_panel,
[
ToggleFocus,
Remove,
Secondary,
CollapseSelectedChannel,
ExpandSelectedChannel,
StartMoveChannel,
MoveSelected,
InsertSpace,
]
);
// impl_actions!(

View file

@ -16,10 +16,13 @@ use util::TryFutureExt;
use workspace::ModalView;
actions!(
SelectNextControl,
ToggleMode,
ToggleMemberAdmin,
RemoveMember
channel_modal,
[
SelectNextControl,
ToggleMode,
ToggleMemberAdmin,
RemoveMember
]
);
// pub fn init(cx: &mut AppContext) {

View file

@ -20,11 +20,14 @@ const MAX_PROJECT_NAME_LENGTH: usize = 40;
const MAX_BRANCH_NAME_LENGTH: usize = 40;
actions!(
ShareProject,
UnshareProject,
ToggleUserMenu,
ToggleProjectMenu,
SwitchBranch
collab,
[
ShareProject,
UnshareProject,
ToggleUserMenu,
ToggleProjectMenu,
SwitchBranch
]
);
pub fn init(cx: &mut AppContext) {

View file

@ -24,7 +24,10 @@ use settings::Settings;
use util::ResultExt;
use workspace::AppState;
actions!(ToggleScreenSharing, ToggleMute, ToggleDeafen, LeaveCall);
actions!(
collab,
[ToggleScreenSharing, ToggleMute, ToggleDeafen, LeaveCall]
);
pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
CollaborationPanelSettings::register(cx);

View file

@ -19,7 +19,7 @@ use util::{
use workspace::{ModalView, Workspace};
use zed_actions::OpenZedURL;
actions!(Toggle);
actions!(command_palette, [Toggle]);
pub fn init(cx: &mut AppContext) {
cx.set_global(HitCounts::default());

View file

@ -34,12 +34,15 @@ use util::{
};
actions!(
Suggest,
NextSuggestion,
PreviousSuggestion,
Reinstall,
SignIn,
SignOut
copilot,
[
Suggest,
NextSuggestion,
PreviousSuggestion,
Reinstall,
SignIn,
SignOut
]
);
pub fn init(

View file

@ -43,7 +43,7 @@ use workspace::{
ItemNavHistory, Pane, ToolbarItemLocation, Workspace,
};
actions!(Deploy, ToggleWarnings);
actions!(diagnostics, [Deploy, ToggleWarnings]);
const CONTEXT_LINE_COUNT: u32 = 1;

View file

@ -277,121 +277,124 @@ impl InlayId {
}
actions!(
AddSelectionAbove,
AddSelectionBelow,
Backspace,
Cancel,
ConfirmRename,
ContextMenuFirst,
ContextMenuLast,
ContextMenuNext,
ContextMenuPrev,
ConvertToKebabCase,
ConvertToLowerCamelCase,
ConvertToLowerCase,
ConvertToSnakeCase,
ConvertToTitleCase,
ConvertToUpperCamelCase,
ConvertToUpperCase,
Copy,
CopyHighlightJson,
CopyPath,
CopyRelativePath,
Cut,
CutToEndOfLine,
Delete,
DeleteLine,
DeleteToBeginningOfLine,
DeleteToEndOfLine,
DeleteToNextSubwordEnd,
DeleteToNextWordEnd,
DeleteToPreviousSubwordStart,
DeleteToPreviousWordStart,
DuplicateLine,
FindAllReferences,
Fold,
FoldSelectedRanges,
Format,
GoToDefinition,
GoToDefinitionSplit,
GoToDiagnostic,
GoToHunk,
GoToPrevDiagnostic,
GoToPrevHunk,
GoToTypeDefinition,
GoToTypeDefinitionSplit,
HalfPageDown,
HalfPageUp,
Hover,
Indent,
JoinLines,
LineDown,
LineUp,
MoveDown,
MoveLeft,
MoveLineDown,
MoveLineUp,
MoveRight,
MoveToBeginning,
MoveToBeginningOfLine,
MoveToEnclosingBracket,
MoveToEnd,
MoveToEndOfLine,
MoveToEndOfParagraph,
MoveToNextSubwordEnd,
MoveToNextWordEnd,
MoveToPreviousSubwordStart,
MoveToPreviousWordStart,
MoveToStartOfParagraph,
MoveUp,
Newline,
NewlineAbove,
NewlineBelow,
NextScreen,
OpenExcerpts,
Outdent,
PageDown,
PageUp,
Paste,
Redo,
RedoSelection,
Rename,
RestartLanguageServer,
RevealInFinder,
ReverseLines,
ScrollCursorBottom,
ScrollCursorCenter,
ScrollCursorTop,
SelectAll,
SelectDown,
SelectLargerSyntaxNode,
SelectLeft,
SelectLine,
SelectRight,
SelectSmallerSyntaxNode,
SelectToBeginning,
SelectToEnd,
SelectToEndOfParagraph,
SelectToNextSubwordEnd,
SelectToNextWordEnd,
SelectToPreviousSubwordStart,
SelectToPreviousWordStart,
SelectToStartOfParagraph,
SelectUp,
ShowCharacterPalette,
ShowCompletions,
ShuffleLines,
SortLinesCaseInsensitive,
SortLinesCaseSensitive,
SplitSelectionIntoLines,
Tab,
TabPrev,
ToggleInlayHints,
ToggleSoftWrap,
Transpose,
Undo,
UndoSelection,
UnfoldLines,
editor,
[
AddSelectionAbove,
AddSelectionBelow,
Backspace,
Cancel,
ConfirmRename,
ContextMenuFirst,
ContextMenuLast,
ContextMenuNext,
ContextMenuPrev,
ConvertToKebabCase,
ConvertToLowerCamelCase,
ConvertToLowerCase,
ConvertToSnakeCase,
ConvertToTitleCase,
ConvertToUpperCamelCase,
ConvertToUpperCase,
Copy,
CopyHighlightJson,
CopyPath,
CopyRelativePath,
Cut,
CutToEndOfLine,
Delete,
DeleteLine,
DeleteToBeginningOfLine,
DeleteToEndOfLine,
DeleteToNextSubwordEnd,
DeleteToNextWordEnd,
DeleteToPreviousSubwordStart,
DeleteToPreviousWordStart,
DuplicateLine,
FindAllReferences,
Fold,
FoldSelectedRanges,
Format,
GoToDefinition,
GoToDefinitionSplit,
GoToDiagnostic,
GoToHunk,
GoToPrevDiagnostic,
GoToPrevHunk,
GoToTypeDefinition,
GoToTypeDefinitionSplit,
HalfPageDown,
HalfPageUp,
Hover,
Indent,
JoinLines,
LineDown,
LineUp,
MoveDown,
MoveLeft,
MoveLineDown,
MoveLineUp,
MoveRight,
MoveToBeginning,
MoveToBeginningOfLine,
MoveToEnclosingBracket,
MoveToEnd,
MoveToEndOfLine,
MoveToEndOfParagraph,
MoveToNextSubwordEnd,
MoveToNextWordEnd,
MoveToPreviousSubwordStart,
MoveToPreviousWordStart,
MoveToStartOfParagraph,
MoveUp,
Newline,
NewlineAbove,
NewlineBelow,
NextScreen,
OpenExcerpts,
Outdent,
PageDown,
PageUp,
Paste,
Redo,
RedoSelection,
Rename,
RestartLanguageServer,
RevealInFinder,
ReverseLines,
ScrollCursorBottom,
ScrollCursorCenter,
ScrollCursorTop,
SelectAll,
SelectDown,
SelectLargerSyntaxNode,
SelectLeft,
SelectLine,
SelectRight,
SelectSmallerSyntaxNode,
SelectToBeginning,
SelectToEnd,
SelectToEndOfParagraph,
SelectToNextSubwordEnd,
SelectToNextWordEnd,
SelectToPreviousSubwordStart,
SelectToPreviousWordStart,
SelectToStartOfParagraph,
SelectUp,
ShowCharacterPalette,
ShowCompletions,
ShuffleLines,
SortLinesCaseInsensitive,
SortLinesCaseSensitive,
SplitSelectionIntoLines,
Tab,
TabPrev,
ToggleInlayHints,
ToggleSoftWrap,
Transpose,
Undo,
UndoSelection,
UnfoldLines,
]
);
enum DocumentHighlightRead {}

View file

@ -26,7 +26,7 @@ pub const MIN_POPOVER_CHARACTER_WIDTH: f32 = 20.;
pub const MIN_POPOVER_LINE_HEIGHT: Pixels = px(4.);
pub const HOVER_POPOVER_GAP: Pixels = px(10.);
actions!(Hover);
actions!(editor, [Hover]);
/// Bindable action which uses the most recent selection head to trigger a hover
pub fn hover(editor: &mut Editor, _: &Hover, cx: &mut ViewContext<Editor>) {

View file

@ -5,15 +5,18 @@ use workspace::Workspace;
pub mod deploy_feedback_button;
pub mod feedback_modal;
actions!(GiveFeedback, SubmitFeedback);
actions!(feedback, [GiveFeedback, SubmitFeedback]);
mod system_specs;
actions!(
CopySystemSpecsIntoClipboard,
FileBugReport,
RequestFeature,
OpenZedCommunityRepo
zed,
[
CopySystemSpecsIntoClipboard,
FileBugReport,
RequestFeature,
OpenZedCommunityRepo
]
);
pub fn init(cx: &mut AppContext) {

View file

@ -19,7 +19,7 @@ use ui::{prelude::*, HighlightedLabel, ListItem};
use util::{paths::PathLikeWithPosition, post_inc, ResultExt};
use workspace::{ModalView, Workspace};
actions!(Toggle);
actions!(file_finder, [Toggle]);
impl ModalView for FileFinder {}

View file

@ -10,7 +10,7 @@ use ui::{h_stack, prelude::*, v_stack, Label};
use util::paths::FILE_ROW_COLUMN_DELIMITER;
use workspace::ModalView;
actions!(Toggle);
actions!(go_to_line, [Toggle]);
pub fn init(cx: &mut AppContext) {
cx.observe_new_views(GoToLine::register).detach();

View file

@ -22,7 +22,7 @@ Actions are frequently unit structs, for which we have a macro. The above could
```rust
mod menu {
actions!(MoveUp, MoveDown);
actions!(gpui, [MoveUp, MoveDown]);
}
```

View file

@ -158,17 +158,65 @@ impl ActionRegistry {
/// To use more complex data types as actions, annotate your type with the #[action] macro.
#[macro_export]
macro_rules! actions {
() => {};
($namespace:path, [ $($name:ident),* $(,)? ]) => {
$(
#[derive(::std::cmp::PartialEq, ::std::clone::Clone, ::std::default::Default, gpui::serde_derive::Deserialize)]
#[serde(crate = "gpui::serde")]
#[gpui::register_action]
pub struct $name;
( $name:ident ) => {
#[derive(::std::cmp::PartialEq, ::std::clone::Clone, ::std::default::Default, gpui::serde_derive::Deserialize, gpui::Action)]
#[serde(crate = "gpui::serde")]
pub struct $name;
gpui::__impl_action!($namespace, $name,
fn build(_: gpui::serde_json::Value) -> gpui::Result<::std::boxed::Box<dyn gpui::Action>> {
Ok(Box::new(Self))
}
);
)*
};
}
( $name:ident, $($rest:tt)* ) => {
actions!($name);
actions!($($rest)*);
#[doc(hidden)]
#[macro_export]
macro_rules! __impl_action {
($namespace:path, $name:ident, $build:item) => {
impl gpui::Action for $name {
fn name(&self) -> &'static str
{
concat!(
stringify!($namespace),
"::",
stringify!($name),
)
}
// todo!() why is this needed in addition to name?
fn debug_name() -> &'static str
where
Self: ::std::marker::Sized
{
concat!(
stringify!($namespace),
"::",
stringify!($name),
)
}
$build
fn partial_eq(&self, action: &dyn gpui::Action) -> bool {
action
.as_any()
.downcast_ref::<Self>()
.map_or(false, |a| self == a)
}
fn boxed_clone(&self) -> std::boxed::Box<dyn gpui::Action> {
::std::boxed::Box::new(self.clone())
}
fn as_any(&self) -> &dyn ::std::any::Any {
self
}
}
};
}
@ -186,5 +234,5 @@ pub fn remove_the_2(action_name: &str) -> String {
mod no_action {
use crate as gpui;
actions!(NoAction);
actions!(zed, [NoAction]);
}

View file

@ -302,7 +302,7 @@ mod test {
focus_handle: FocusHandle,
}
actions!(TestAction);
actions!(test, [TestAction]);
impl Render for TestView {
type Element = Stateful<Div>;

View file

@ -293,11 +293,13 @@ mod tests {
#[test]
fn test_actions_definition() {
{
actions!(A, B, C, D, E, F, G);
actions!(test, [A, B, C, D, E, F, G]);
}
{
actions!(
test,
[
A,
B,
C,
@ -305,6 +307,7 @@ mod tests {
E,
F,
G, // Don't wrap, test the trailing comma
]
);
}
}

View file

@ -78,7 +78,7 @@ pub(crate) fn register_action(type_name: &Ident) -> proc_macro2::TokenStream {
#[doc(hidden)]
fn #action_builder_fn_name() -> gpui::ActionData {
gpui::ActionData {
name: ::std::any::type_name::<#type_name>(),
name: <#type_name as gpui::Action>::debug_name(),
type_id: ::std::any::TypeId::of::<#type_name>(),
build: <#type_name as gpui::Action>::build,
}

View file

@ -3,7 +3,7 @@ use gpui::{actions, AsyncAppContext};
use std::path::Path;
use util::ResultExt;
actions!(Install);
actions!(cli, [Install]);
pub async fn install_cli(cx: &AsyncAppContext) -> Result<()> {
let cli_path = cx.update(|cx| cx.path_for_auxiliary_executable("cli"))??;

View file

@ -16,7 +16,7 @@ use ui::{prelude::*, HighlightedLabel, ListItem};
use util::ResultExt;
use workspace::{ModalView, Workspace};
actions!(Toggle);
actions!(language_selector, [Toggle]);
pub fn init(cx: &mut AppContext) {
cx.observe_new_views(LanguageSelector::register).detach();

View file

@ -10,12 +10,15 @@ use gpui::actions;
pub fn init() {}
actions!(
Cancel,
Confirm,
SecondaryConfirm,
SelectPrev,
SelectNext,
SelectFirst,
SelectLast,
ShowContextMenu
menu,
[
Cancel,
Confirm,
SecondaryConfirm,
SelectPrev,
SelectNext,
SelectFirst,
SelectLast,
ShowContextMenu
]
);

View file

@ -22,7 +22,7 @@ use ui::{prelude::*, ListItem};
use util::ResultExt;
use workspace::{ModalView, Workspace};
actions!(Toggle);
actions!(outline, [Toggle]);
pub fn init(cx: &mut AppContext) {
cx.observe_new_views(OutlineView::register).detach();

View file

@ -103,23 +103,26 @@ pub struct EntryDetails {
}
actions!(
ExpandSelectedEntry,
CollapseSelectedEntry,
CollapseAllEntries,
NewDirectory,
NewFile,
Copy,
CopyPath,
CopyRelativePath,
RevealInFinder,
OpenInTerminal,
Cut,
Paste,
Delete,
Rename,
Open,
ToggleFocus,
NewSearchInDirectory,
project_panel,
[
ExpandSelectedEntry,
CollapseSelectedEntry,
CollapseAllEntries,
NewDirectory,
NewFile,
Copy,
CopyPath,
CopyRelativePath,
RevealInFinder,
OpenInTerminal,
Cut,
Paste,
Delete,
Rename,
Open,
ToggleFocus,
NewSearchInDirectory,
]
);
pub fn init_settings(cx: &mut AppContext) {

View file

@ -1 +1 @@
gpui::actions!(OpenRecent);
gpui::actions!(projects, [OpenRecent]);

View file

@ -31,7 +31,7 @@ pub struct Deploy {
pub focus: bool,
}
actions!(Dismiss, FocusEditor);
actions!(buffer_search, [Dismiss, FocusEditor]);
pub enum Event {
UpdateLocation,

View file

@ -22,20 +22,23 @@ pub fn init(cx: &mut AppContext) {
}
actions!(
CycleMode,
ToggleWholeWord,
ToggleCaseSensitive,
ToggleReplace,
SelectNextMatch,
SelectPrevMatch,
SelectAllMatches,
NextHistoryQuery,
PreviousHistoryQuery,
ActivateTextMode,
ActivateSemanticMode,
ActivateRegexMode,
ReplaceAll,
ReplaceNext,
search,
[
CycleMode,
ToggleWholeWord,
ToggleCaseSensitive,
ToggleReplace,
SelectNextMatch,
SelectPrevMatch,
SelectAllMatches,
NextHistoryQuery,
PreviousHistoryQuery,
ActivateTextMode,
ActivateSemanticMode,
ActivateRegexMode,
ReplaceAll,
ReplaceNext,
]
);
bitflags! {

View file

@ -1,7 +1,7 @@
use crate::{settings_store::parse_json_with_comments, SettingsAssets};
use anyhow::{anyhow, Context, Result};
use collections::BTreeMap;
use gpui::{actions, Action, AppContext, KeyBinding, SharedString};
use gpui::{Action, AppContext, KeyBinding, SharedString};
use schemars::{
gen::{SchemaGenerator, SchemaSettings},
schema::{InstanceType, Schema, SchemaObject, SingleOrVec, SubschemaValidation},
@ -137,10 +137,8 @@ impl KeymapFile {
}
}
actions!(NoAction);
fn no_action() -> Box<dyn gpui::Action> {
NoAction.boxed_clone()
gpui::NoAction.boxed_clone()
}
#[cfg(test)]

View file

@ -4,7 +4,7 @@ use gpui::{
};
use ui::prelude::*;
actions!(ActionA, ActionB, ActionC);
actions!(focus, [ActionA, ActionB, ActionC]);
pub struct FocusStory {
child_1_focus: FocusHandle,

View file

@ -59,13 +59,16 @@ use crate::mappings::{colors::to_alac_rgb, keys::to_esc_str};
use lazy_static::lazy_static;
actions!(
Clear,
Copy,
Paste,
ShowCharacterPalette,
SearchTest,
SendText,
SendKeystroke,
terminal,
[
Clear,
Copy,
Paste,
ShowCharacterPalette,
SearchTest,
SendText,
SendKeystroke,
]
);
///Scrolling is unbearably sluggish by default. Alacritty supports a configurable

View file

@ -24,7 +24,7 @@ use anyhow::Result;
const TERMINAL_PANEL_KEY: &'static str = "TerminalPanel";
actions!(ToggleFocus);
actions!(terminal_view, [ToggleFocus]);
pub fn init(cx: &mut AppContext) {
cx.observe_new_views(

View file

@ -13,7 +13,7 @@ use ui::{prelude::*, v_stack, ListItem};
use util::ResultExt;
use workspace::{ui::HighlightedLabel, ModalView, Workspace};
actions!(Toggle, Reload);
actions!(theme_selector, [Toggle, Reload]);
pub fn init(cx: &mut AppContext) {
cx.observe_new_views(

View file

@ -4,7 +4,7 @@ use story::Story;
use crate::prelude::*;
use crate::{right_click_menu, ContextMenu, Label};
actions!(PrintCurrentDate, PrintBestFood);
actions!(context_menu, [PrintCurrentDate, PrintBestFood]);
fn build_menu(cx: &mut WindowContext, header: impl Into<SharedString>) -> View<ContextMenu> {
ContextMenu::build(cx, |menu, _| {

View file

@ -1,4 +1,5 @@
use gpui::{actions, Div, Render};
use gpui::NoAction;
use gpui::{Div, Render};
use itertools::Itertools;
use story::Story;
@ -7,8 +8,6 @@ use crate::KeyBinding;
pub struct KeybindingStory;
actions!(NoAction);
pub fn binding(key: &str) -> gpui::KeyBinding {
gpui::KeyBinding::new(key, NoAction {}, None)
}

View file

@ -12,7 +12,7 @@ use ui::{prelude::*, ListItem};
use util::ResultExt;
use workspace::{ui::HighlightedLabel, ModalView, Workspace};
actions!(ToggleBaseKeymapSelector);
actions!(welcome, [ToggleBaseKeymapSelector]);
pub fn init(cx: &mut AppContext) {
cx.observe_new_views(|workspace: &mut Workspace, _cx| {

View file

@ -770,7 +770,7 @@ pub mod test {
pub focus_handle: FocusHandle,
pub size: f32,
}
actions!(ToggleTestPanel);
actions!(test, [ToggleTestPanel]);
impl EventEmitter<PanelEvent> for TestPanel {}

View file

@ -87,22 +87,24 @@ pub struct CloseAllItems {
pub save_intent: Option<SaveIntent>,
}
// todo!(These used to be under pane::{Action}. Are they now workspace::pane::{Action}?)
actions!(
ActivatePrevItem,
ActivateNextItem,
ActivateLastItem,
CloseInactiveItems,
CloseCleanItems,
CloseItemsToTheLeft,
CloseItemsToTheRight,
GoBack,
GoForward,
ReopenClosedItem,
SplitLeft,
SplitUp,
SplitRight,
SplitDown,
pane,
[
ActivatePrevItem,
ActivateNextItem,
ActivateLastItem,
CloseInactiveItems,
CloseCleanItems,
CloseItemsToTheLeft,
CloseItemsToTheRight,
GoBack,
GoForward,
ReopenClosedItem,
SplitLeft,
SplitUp,
SplitRight,
SplitDown,
]
);
const MAX_NAVIGATION_HISTORY_LEN: usize = 1024;

View file

@ -91,30 +91,33 @@ lazy_static! {
pub struct RemoveWorktreeFromProject(pub WorktreeId);
actions!(
Open,
NewFile,
NewWindow,
CloseWindow,
CloseInactiveTabsAndPanes,
AddFolderToProject,
Unfollow,
SaveAs,
ReloadActiveItem,
ActivatePreviousPane,
ActivateNextPane,
FollowNextCollaborator,
NewTerminal,
NewCenterTerminal,
ToggleTerminalFocus,
NewSearch,
Feedback,
Restart,
Welcome,
ToggleZoom,
ToggleLeftDock,
ToggleRightDock,
ToggleBottomDock,
CloseAllDocks,
workspace,
[
Open,
NewFile,
NewWindow,
CloseWindow,
CloseInactiveTabsAndPanes,
AddFolderToProject,
Unfollow,
SaveAs,
ReloadActiveItem,
ActivatePreviousPane,
ActivateNextPane,
FollowNextCollaborator,
NewTerminal,
NewCenterTerminal,
ToggleTerminalFocus,
NewSearch,
Feedback,
Restart,
Welcome,
ToggleZoom,
ToggleLeftDock,
ToggleRightDock,
ToggleBottomDock,
CloseAllDocks,
]
);
#[derive(Clone, PartialEq)]

View file

@ -43,27 +43,30 @@ use workspace::{
use zed_actions::{OpenBrowser, OpenZedURL};
actions!(
About,
DebugElements,
DecreaseBufferFontSize,
Hide,
HideOthers,
IncreaseBufferFontSize,
Minimize,
OpenDefaultKeymap,
OpenDefaultSettings,
OpenKeymap,
OpenLicenses,
OpenLocalSettings,
OpenLog,
OpenSettings,
OpenTelemetryLog,
Quit,
ResetBufferFontSize,
ResetDatabase,
ShowAll,
ToggleFullScreen,
Zoom,
zed,
[
About,
DebugElements,
DecreaseBufferFontSize,
Hide,
HideOthers,
IncreaseBufferFontSize,
Minimize,
OpenDefaultKeymap,
OpenDefaultSettings,
OpenKeymap,
OpenLicenses,
OpenLocalSettings,
OpenLog,
OpenSettings,
OpenTelemetryLog,
Quit,
ResetBufferFontSize,
ResetDatabase,
ShowAll,
ToggleFullScreen,
Zoom,
]
);
pub fn build_window_options(