project_panel: Automatically open project panel when Rename or Duplicate is triggered from workspace (#34988)

In project panel, `rename` and `duplicate` action further needs user
input for editing, so if panel is closed we should open it.

Release Notes:

- Fixed project panel not opening when `project panel: rename` and
`project panel: duplicate` actions are triggered from workspace.
This commit is contained in:
Smit Barmase 2025-07-24 05:26:12 +05:30 committed by GitHub
parent 3d4266bb8f
commit 31afda3c0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -322,6 +322,7 @@ pub fn init(cx: &mut App) {
});
workspace.register_action(|workspace, action: &Rename, window, cx| {
workspace.open_panel::<ProjectPanel>(window, cx);
if let Some(panel) = workspace.panel::<ProjectPanel>(cx) {
panel.update(cx, |panel, cx| {
if let Some(first_marked) = panel.marked_entries.first() {
@ -335,6 +336,7 @@ pub fn init(cx: &mut App) {
});
workspace.register_action(|workspace, action: &Duplicate, window, cx| {
workspace.open_panel::<ProjectPanel>(window, cx);
if let Some(panel) = workspace.panel::<ProjectPanel>(cx) {
panel.update(cx, |panel, cx| {
panel.duplicate(action, window, cx);