Skip to content

Commit

Permalink
pane: Add "Reveal In File Manager" action to context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Poldraunic committed Dec 2, 2024
1 parent 19641d4 commit d2321fc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions crates/workspace/src/pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ pub struct RevealInProjectPanel {
pub entry_id: Option<u64>,
}

#[derive(Clone, PartialEq, Debug, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RevealInFileManager {}

#[derive(Default, PartialEq, Clone, Deserialize)]
pub struct DeploySearch {
#[serde(default)]
Expand All @@ -161,6 +165,7 @@ impl_actions!(
CloseInactiveItems,
ActivateItem,
RevealInProjectPanel,
RevealInFileManager,
DeploySearch,
]
);
Expand Down Expand Up @@ -2258,6 +2263,21 @@ impl Pane {
}),
)
})
.when_some(parent_abs_path.clone(), |menu, parent_abs_path| {
let reveal_in_finder_label = if cfg!(target_os = "macos") {
"Reveal in Finder"
} else {
"Reveal in File Manager"
};

menu.entry(
reveal_in_finder_label,
Some(Box::new(RevealInFileManager {})),
cx.handler_for(&pane, move |_, cx| {
cx.reveal_path(&parent_abs_path);
}),
)
})
.when_some(parent_abs_path, |menu, parent_abs_path| {
menu.entry(
"Open in Terminal",
Expand Down

0 comments on commit d2321fc

Please sign in to comment.