From d3fb8ef3723decdadb471d044e4ac3d552c2f6af Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Sat, 28 Feb 2026 10:05:40 +0000 Subject: [PATCH] Revert "settings: Await config worktree before opening settings.json" (#50380) (cherry-pick to stable) (#50383) Cherry-pick of #50380 to stable ---- Reverts zed-industries/zed#47199 Closes https://github.com/zed-industries/zed/issues/50237 Release Notes: - Fixed a bug that prevented settings files from opening on remotes Co-authored-by: Lukas Wirth --- crates/zed/src/zed.rs | 59 +++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 420901b51f319b97d5ee4e35808dd31d93dc0346..3216f14eb9ae62350665a71ab72f36737e4b559c 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -2044,40 +2044,39 @@ fn open_settings_file( cx: &mut Context, ) { cx.spawn_in(window, async move |workspace, cx| { - let settings_open_task = workspace + let (worktree_creation_task, settings_open_task) = workspace .update_in(cx, |workspace, window, cx| { - workspace.with_local_workspace(window, cx, move |_workspace, window, cx| { - cx.spawn_in(window, async move |workspace, cx| { - let worktree_creation_task = - workspace.update_in(cx, |workspace, _window, cx| { - workspace.project().update(cx, |project, cx| { - // Set up a dedicated worktree for settings, since - // otherwise we're dropping and re-starting LSP servers - // for each file inside on every settings file - // close/open - - // TODO: Do note that all other external files (e.g. - // drag and drop from OS) still have their worktrees - // released on file close, causing LSP servers' - // restarts. - project.find_or_create_worktree( - paths::config_dir().as_path(), - false, - cx, - ) - }) - })?; - let _ = worktree_creation_task.await?; - let settings_open_task = - workspace.update_in(cx, |_workspace, window, cx| { - create_and_open_local_file(abs_path, window, cx, default_content) - })?; - let _ = settings_open_task.await?; - anyhow::Ok(()) - }) + workspace.with_local_or_wsl_workspace(window, cx, move |workspace, window, cx| { + let project = workspace.project().clone(); + + let worktree_creation_task = cx.spawn_in(window, async move |_, cx| { + let config_dir = project + .update(cx, |project, cx| { + project.try_windows_path_to_wsl(paths::config_dir().as_path(), cx) + }) + .await?; + // Set up a dedicated worktree for settings, since + // otherwise we're dropping and re-starting LSP servers + // for each file inside on every settings file + // close/open + + // TODO: Do note that all other external files (e.g. + // drag and drop from OS) still have their worktrees + // released on file close, causing LSP servers' + // restarts. + project + .update(cx, |project, cx| { + project.find_or_create_worktree(&config_dir, false, cx) + }) + .await + }); + let settings_open_task = + create_and_open_local_file(abs_path, window, cx, default_content); + (worktree_creation_task, settings_open_task) }) })? .await?; + let _ = worktree_creation_task.await?; let _ = settings_open_task.await?; anyhow::Ok(()) })