From 02af8dde1688fcd88ec5d165d239d65dfe28ed72 Mon Sep 17 00:00:00 2001 From: tims <0xtimsb@gmail.com> Date: Tue, 28 Jan 2025 14:40:00 +0530 Subject: [PATCH] menus: Add "Open File" action for Linux and Windows (#23707) This PR adds menu item for `workspace::OpenFiles` in app menu on Linux and Windows. Context: When opening a file or folder on Linux and Windows via the native file picker, the picker can be either in file-only mode or folder-only mode. This means you have to open it already knowing whether you want to open a file or a folder, unlike macOS, which lets you choose either in the same picker. For this reason, a new action, `workspace::OpenFiles`, was recently added for Linux and Windows. This is basically file-only mode, alongside the existing `workspace::Open` action, which is folder-only. In macOS, the `workspace::Open` action is sufficient to open both file and folder. Before: Before After: After Release Notes: - Added "Open File" action in file menu for Linux and Windows. --- crates/zed/src/zed/app_menus.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/zed/src/zed/app_menus.rs b/crates/zed/src/zed/app_menus.rs index b3817f5578fa62d2466bad530d610ceba7410093..c50de09f3dd4f852916c76617ca72af82a751dd1 100644 --- a/crates/zed/src/zed/app_menus.rs +++ b/crates/zed/src/zed/app_menus.rs @@ -53,7 +53,16 @@ pub fn app_menus() -> Vec { MenuItem::action("New", workspace::NewFile), MenuItem::action("New Window", workspace::NewWindow), MenuItem::separator(), - MenuItem::action("Open…", workspace::Open), + #[cfg(not(target_os = "macos"))] + MenuItem::action("Open File...", workspace::OpenFiles), + MenuItem::action( + if cfg!(not(target_os = "macos")) { + "Open Folder..." + } else { + "Open…" + }, + workspace::Open, + ), MenuItem::action( "Open Recent...", zed_actions::OpenRecent {