Skip to content

Commit

Permalink
pane: Hide "Reveal In Project Panel" action if file doesn't belong to…
Browse files Browse the repository at this point in the history
… a worktree

Building on the previous commit before we now also hide this action.
  • Loading branch information
Poldraunic committed Dec 2, 2024
1 parent f5c89e7 commit 19641d4
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions crates/workspace/src/pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2214,6 +2214,7 @@ impl Pane {
.and_then(|item| item.project_path(cx))
.map(|project_path| project_path.path)
.map_or(None, |path| if path.exists() { Some(path) } else { None });
let has_relative_path = relative_path.is_some();

let entry_id = entry.to_proto();
menu = menu
Expand Down Expand Up @@ -2242,19 +2243,21 @@ impl Pane {
})
.map(pin_tab_entries)
.separator()
.entry(
"Reveal In Project Panel",
Some(Box::new(RevealInProjectPanel {
entry_id: Some(entry_id),
})),
cx.handler_for(&pane, move |pane, cx| {
pane.project.update(cx, |_, cx| {
cx.emit(project::Event::RevealInProjectPanel(
ProjectEntryId::from_proto(entry_id),
))
});
}),
)
.when(has_relative_path, |menu| {
menu.entry(
"Reveal In Project Panel",
Some(Box::new(RevealInProjectPanel {
entry_id: Some(entry_id),
})),
cx.handler_for(&pane, move |pane, cx| {
pane.project.update(cx, |_, cx| {
cx.emit(project::Event::RevealInProjectPanel(
ProjectEntryId::from_proto(entry_id),
))
});
}),
)
})
.when_some(parent_abs_path, |menu, parent_abs_path| {
menu.entry(
"Open in Terminal",
Expand Down

0 comments on commit 19641d4

Please sign in to comment.