Allow to reuse windows in open remote projects dialogue (#32138)

Closes https://github.com/zed-industries/zed/issues/26276

Same as other "open window" actions like "open recent", add a
`"create_new_window": false` (default `false`) argument into the
`projects::OpenRemote` action.

Make all menus to use this default; allow users to change this in the
keybindings.
Same as with other actions, `cmd`/`ctrl` inverts the parameter value.

<img width="554" alt="default"
src="https://github.com/user-attachments/assets/156d50f0-6511-47b3-b650-7a5133ae9541"
/>

<img width="552" alt="override"
src="https://github.com/user-attachments/assets/cf7d963b-86a3-4925-afec-fdb5414418e1"
/>

Release Notes:

- Allowed to reuse windows in open remote projects dialogue
This commit is contained in:
Kirill Bulatov 2025-06-05 10:09:09 +03:00 committed by GitHub
parent 274a40b7e0
commit 9d533f9d30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 82 additions and 25 deletions

View file

@ -50,6 +50,7 @@ pub fn init(cx: &mut App) {
});
cx.on_action(|open_remote: &OpenRemote, cx| {
let from_existing_connection = open_remote.from_existing_connection;
let create_new_window = open_remote.create_new_window;
with_active_or_new_workspace(cx, move |workspace, window, cx| {
if from_existing_connection {
cx.propagate();
@ -58,7 +59,7 @@ pub fn init(cx: &mut App) {
let handle = cx.entity().downgrade();
let fs = workspace.project().read(cx).fs().clone();
workspace.toggle_modal(window, cx, |window, cx| {
RemoteServerProjects::new(fs, window, cx, handle)
RemoteServerProjects::new(create_new_window, fs, window, handle, cx)
})
});
});
@ -480,6 +481,7 @@ impl PickerDelegate for RecentProjectsDelegate {
.key_binding(KeyBinding::for_action(
&OpenRemote {
from_existing_connection: false,
create_new_window: false,
},
window,
cx,
@ -488,6 +490,7 @@ impl PickerDelegate for RecentProjectsDelegate {
window.dispatch_action(
OpenRemote {
from_existing_connection: false,
create_new_window: false,
}
.boxed_clone(),
cx,