Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

workspace: Prefer active window over other local non-collab windows for opening file (#23726)

timsd090caccd7a3
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index 72589725aa8..b901140d989 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -5944,6 +5944,19 @@ pub fn open_paths(
.all(|file| !file.is_dir)
{
cx.update(|cx| {
+ if let Some(window) = cx
+ .active_window()
+ .and_then(|window| window.downcast::<Workspace>())
+ {
+ if let Ok(workspace) = window.read(cx) {
+ let project = workspace.project().read(cx);
+ if project.is_local() && !project.is_via_collab() {
+ existing = Some(window);
+ open_visible = OpenVisible::None;
+ return;
+ }
+ }
+ }
for window in local_workspace_windows(cx) {
if let Ok(workspace) = window.read(cx) {
let project = workspace.project().read(cx);