Reveal in files instead of Finder (#13432)

fixes: #12776 

Release Notes:

- Renamed `editor::RevealInFinder` to `editor::RevealInFileManager`

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
francesco-gaglione 2024-07-09 20:54:14 +02:00 committed by GitHub
parent f44e81b3b5
commit 2dd486733b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 38 additions and 21 deletions

View file

@ -296,8 +296,8 @@
"ctrl-shift-]": "editor::UnfoldLines", "ctrl-shift-]": "editor::UnfoldLines",
"ctrl-space": "editor::ShowCompletions", "ctrl-space": "editor::ShowCompletions",
"ctrl-.": "editor::ToggleCodeActions", "ctrl-.": "editor::ToggleCodeActions",
"alt-ctrl-r": "editor::RevealInFinder", "alt-ctrl-r": "editor::RevealInFileManager",
"ctrl-k r": "editor::RevealInFinder", "ctrl-k r": "editor::RevealInFileManager",
"ctrl-k p": "editor::CopyPath", "ctrl-k p": "editor::CopyPath",
"ctrl-\\": "pane::SplitRight", "ctrl-\\": "pane::SplitRight",
"ctrl-k v": "markdown::OpenPreviewToTheSide", "ctrl-k v": "markdown::OpenPreviewToTheSide",
@ -507,7 +507,7 @@
"right": "outline_panel::ExpandSelectedEntry", "right": "outline_panel::ExpandSelectedEntry",
"ctrl-alt-c": "outline_panel::CopyPath", "ctrl-alt-c": "outline_panel::CopyPath",
"alt-ctrl-shift-c": "outline_panel::CopyRelativePath", "alt-ctrl-shift-c": "outline_panel::CopyRelativePath",
"alt-ctrl-r": "outline_panel::RevealInFinder", "alt-ctrl-r": "outline_panel::RevealInFileManager",
"space": "outline_panel::Open", "space": "outline_panel::Open",
"shift-down": "menu::SelectNext", "shift-down": "menu::SelectNext",
"shift-up": "menu::SelectPrev" "shift-up": "menu::SelectPrev"
@ -534,7 +534,7 @@
"delete": ["project_panel::Trash", { "skip_prompt": false }], "delete": ["project_panel::Trash", { "skip_prompt": false }],
"ctrl-backspace": ["project_panel::Delete", { "skip_prompt": false }], "ctrl-backspace": ["project_panel::Delete", { "skip_prompt": false }],
"ctrl-delete": ["project_panel::Delete", { "skip_prompt": false }], "ctrl-delete": ["project_panel::Delete", { "skip_prompt": false }],
"alt-ctrl-r": "project_panel::RevealInFinder", "alt-ctrl-r": "project_panel::RevealInFileManager",
"alt-shift-f": "project_panel::NewSearchInDirectory", "alt-shift-f": "project_panel::NewSearchInDirectory",
"shift-down": "menu::SelectNext", "shift-down": "menu::SelectNext",
"shift-up": "menu::SelectPrev", "shift-up": "menu::SelectPrev",

View file

@ -336,8 +336,8 @@
"alt-cmd-]": "editor::UnfoldLines", "alt-cmd-]": "editor::UnfoldLines",
"ctrl-space": "editor::ShowCompletions", "ctrl-space": "editor::ShowCompletions",
"cmd-.": "editor::ToggleCodeActions", "cmd-.": "editor::ToggleCodeActions",
"alt-cmd-r": "editor::RevealInFinder", "alt-cmd-r": "editor::RevealInFileManager",
"cmd-k r": "editor::RevealInFinder", "cmd-k r": "editor::RevealInFileManager",
"cmd-k p": "editor::CopyPath", "cmd-k p": "editor::CopyPath",
"cmd-\\": "pane::SplitRight", "cmd-\\": "pane::SplitRight",
"cmd-k v": "markdown::OpenPreviewToTheSide", "cmd-k v": "markdown::OpenPreviewToTheSide",
@ -528,7 +528,7 @@
"right": "outline_panel::ExpandSelectedEntry", "right": "outline_panel::ExpandSelectedEntry",
"cmd-alt-c": "outline_panel::CopyPath", "cmd-alt-c": "outline_panel::CopyPath",
"alt-cmd-shift-c": "outline_panel::CopyRelativePath", "alt-cmd-shift-c": "outline_panel::CopyRelativePath",
"alt-cmd-r": "outline_panel::RevealInFinder", "alt-cmd-r": "outline_panel::RevealInFileManager",
"space": "outline_panel::Open", "space": "outline_panel::Open",
"shift-down": "menu::SelectNext", "shift-down": "menu::SelectNext",
"shift-up": "menu::SelectPrev" "shift-up": "menu::SelectPrev"
@ -553,8 +553,9 @@
"delete": ["project_panel::Trash", { "skip_prompt": false }], "delete": ["project_panel::Trash", { "skip_prompt": false }],
"cmd-backspace": ["project_panel::Trash", { "skip_prompt": true }], "cmd-backspace": ["project_panel::Trash", { "skip_prompt": true }],
"cmd-delete": ["project_panel::Delete", { "skip_prompt": false }], "cmd-delete": ["project_panel::Delete", { "skip_prompt": false }],
"alt-cmd-r": "project_panel::RevealInFileManager",
"cmd-alt-backspace": ["project_panel::Delete", { "skip_prompt": false }], "cmd-alt-backspace": ["project_panel::Delete", { "skip_prompt": false }],
"alt-cmd-r": "project_panel::RevealInFinder",
"alt-shift-f": "project_panel::NewSearchInDirectory", "alt-shift-f": "project_panel::NewSearchInDirectory",
"shift-down": "menu::SelectNext", "shift-down": "menu::SelectNext",
"shift-up": "menu::SelectPrev", "shift-up": "menu::SelectPrev",

View file

@ -504,7 +504,7 @@
"t": "project_panel::OpenPermanent", "t": "project_panel::OpenPermanent",
"v": "project_panel::OpenPermanent", "v": "project_panel::OpenPermanent",
"p": "project_panel::Open", "p": "project_panel::Open",
"x": "project_panel::RevealInFinder", "x": "project_panel::RevealInFileManager",
"shift-g": "menu::SelectLast", "shift-g": "menu::SelectLast",
"g g": "menu::SelectFirst", "g g": "menu::SelectFirst",
"-": "project_panel::SelectParent" "-": "project_panel::SelectParent"

View file

@ -258,7 +258,7 @@ gpui::actions!(
RedoSelection, RedoSelection,
Rename, Rename,
RestartLanguageServer, RestartLanguageServer,
RevealInFinder, RevealInFileManager,
ReverseLines, ReverseLines,
RevertSelectedHunks, RevertSelectedHunks,
ScrollCursorBottom, ScrollCursorBottom,

View file

@ -10333,7 +10333,7 @@ impl Editor {
cx.notify(); cx.notify();
} }
pub fn reveal_in_finder(&mut self, _: &RevealInFinder, cx: &mut ViewContext<Self>) { pub fn reveal_in_finder(&mut self, _: &RevealInFileManager, cx: &mut ViewContext<Self>) {
if let Some(buffer) = self.buffer().read(cx).as_singleton() { if let Some(buffer) = self.buffer().read(cx).as_singleton() {
if let Some(file) = buffer.read(cx).file().and_then(|f| f.as_local()) { if let Some(file) = buffer.read(cx).file().and_then(|f| f.as_local()) {
cx.reveal_path(&file.abs_path(cx)); cx.reveal_path(&file.abs_path(cx));

View file

@ -3,9 +3,10 @@ use std::ops::Range;
use crate::{ use crate::{
selections_collection::SelectionsCollection, Copy, CopyPermalinkToLine, Cut, DisplayPoint, selections_collection::SelectionsCollection, Copy, CopyPermalinkToLine, Cut, DisplayPoint,
DisplaySnapshot, Editor, EditorMode, FindAllReferences, GoToDefinition, GoToImplementation, DisplaySnapshot, Editor, EditorMode, FindAllReferences, GoToDefinition, GoToImplementation,
GoToTypeDefinition, Paste, Rename, RevealInFinder, SelectMode, ToDisplayPoint, GoToTypeDefinition, Paste, Rename, RevealInFileManager, SelectMode, ToDisplayPoint,
ToggleCodeActions, ToggleCodeActions,
}; };
use gpui::prelude::FluentBuilder;
use gpui::{DismissEvent, Pixels, Point, Subscription, View, ViewContext}; use gpui::{DismissEvent, Pixels, Point, Subscription, View, ViewContext};
use workspace::OpenInTerminal; use workspace::OpenInTerminal;
@ -113,7 +114,12 @@ pub fn deploy_context_menu(
.action("Copy", Box::new(Copy)) .action("Copy", Box::new(Copy))
.action("Paste", Box::new(Paste)) .action("Paste", Box::new(Paste))
.separator() .separator()
.action("Reveal in Finder", Box::new(RevealInFinder)) .when(cfg!(target_os = "macos"), |builder| {
builder.action("Reveal in Finder", Box::new(RevealInFileManager))
})
.when(cfg!(not(target_os = "macos")), |builder| {
builder.action("Reveal in File Manager", Box::new(RevealInFileManager))
})
.action("Open in Terminal", Box::new(OpenInTerminal)) .action("Open in Terminal", Box::new(OpenInTerminal))
.action("Copy Permalink", Box::new(CopyPermalinkToLine)); .action("Copy Permalink", Box::new(CopyPermalinkToLine));
match focus { match focus {

View file

@ -57,7 +57,7 @@ actions!(
CollapseAllEntries, CollapseAllEntries,
CopyPath, CopyPath,
CopyRelativePath, CopyRelativePath,
RevealInFinder, RevealInFileManager,
Open, Open,
ToggleFocus, ToggleFocus,
UnfoldDirectory, UnfoldDirectory,
@ -796,7 +796,12 @@ impl OutlinePanel {
let context_menu = ContextMenu::build(cx, |menu, _| { let context_menu = ContextMenu::build(cx, |menu, _| {
menu.context(self.focus_handle.clone()) menu.context(self.focus_handle.clone())
.action("Reveal in Finder", Box::new(RevealInFinder)) .when(cfg!(target_os = "macos"), |menu| {
menu.action("Reveal in Finder", Box::new(RevealInFileManager))
})
.when(cfg!(not(target_os = "macos")), |menu| {
menu.action("Reveal in File Manager", Box::new(RevealInFileManager))
})
.action("Open in Terminal", Box::new(OpenInTerminal)) .action("Open in Terminal", Box::new(OpenInTerminal))
.when(is_unfoldable, |menu| { .when(is_unfoldable, |menu| {
menu.action("Unfold Directory", Box::new(UnfoldDirectory)) menu.action("Unfold Directory", Box::new(UnfoldDirectory))
@ -1079,7 +1084,7 @@ impl OutlinePanel {
} }
} }
fn reveal_in_finder(&mut self, _: &RevealInFinder, cx: &mut ViewContext<Self>) { fn reveal_in_finder(&mut self, _: &RevealInFileManager, cx: &mut ViewContext<Self>) {
if let Some(abs_path) = self if let Some(abs_path) = self
.selected_entry .selected_entry
.as_ref() .as_ref()

View file

@ -137,7 +137,7 @@ actions!(
CopyPath, CopyPath,
CopyRelativePath, CopyRelativePath,
Duplicate, Duplicate,
RevealInFinder, RevealInFileManager,
Cut, Cut,
Paste, Paste,
Rename, Rename,
@ -477,7 +477,12 @@ impl ProjectPanel {
menu.action("New File", Box::new(NewFile)) menu.action("New File", Box::new(NewFile))
.action("New Folder", Box::new(NewDirectory)) .action("New Folder", Box::new(NewDirectory))
.separator() .separator()
.action("Reveal in Finder", Box::new(RevealInFinder)) .when(cfg!(target_os = "macos"), |menu| {
menu.action("Reveal in Finder", Box::new(RevealInFileManager))
})
.when(cfg!(not(target_os = "macos")), |menu| {
menu.action("Reveal in File Manager", Box::new(RevealInFileManager))
})
.action("Open in Terminal", Box::new(OpenInTerminal)) .action("Open in Terminal", Box::new(OpenInTerminal))
.when(is_dir, |menu| { .when(is_dir, |menu| {
menu.separator() menu.separator()
@ -1353,7 +1358,7 @@ impl ProjectPanel {
} }
} }
fn reveal_in_finder(&mut self, _: &RevealInFinder, cx: &mut ViewContext<Self>) { fn reveal_in_finder(&mut self, _: &RevealInFileManager, cx: &mut ViewContext<Self>) {
if let Some((worktree, entry)) = self.selected_entry(cx) { if let Some((worktree, entry)) = self.selected_entry(cx) {
cx.reveal_path(&worktree.abs_path().join(&entry.path)); cx.reveal_path(&worktree.abs_path().join(&entry.path));
} }

View file

@ -267,7 +267,7 @@ See the [tasks documentation](/docs/tasks#custom-keybindings-for-tasks) for more
| Redo | Editor | `⌘ + Shift + Z` | | Redo | Editor | `⌘ + Shift + Z` |
| Redo selection | Editor | `⌘ + Shift + U` | | Redo selection | Editor | `⌘ + Shift + U` |
| Rename | Editor | `F2` | | Rename | Editor | `F2` |
| Reveal in finder | Editor | `Alt + ⌘ + R` | | Reveal in File Manager | Editor | `Alt + ⌘ + R` |
| Revert selected hunks | Editor | `⌘ + Alt + Z` | | Revert selected hunks | Editor | `⌘ + Alt + Z` |
| Select all | Editor | `⌘ + A` | | Select all | Editor | `⌘ + A` |
| Select all matches | Editor | `⌘ + Shift + L` | | Select all matches | Editor | `⌘ + Shift + L` |
@ -483,7 +483,7 @@ See the [tasks documentation](/docs/tasks#custom-keybindings-for-tasks) for more
| Paste | Project Panel | `⌘ + V` | | Paste | Project Panel | `⌘ + V` |
| Rename | Project Panel | `Enter` | | Rename | Project Panel | `Enter` |
| Rename | Project Panel | `F2` | | Rename | Project Panel | `F2` |
| Reveal in finder | Project Panel | `Alt + ⌘ + R` | | Reveal in File Manager | Project Panel | `Alt + ⌘ + R` |
#### Project Search Bar #### Project Search Bar