From 20724716ec1ea6b8f5be0d18ed027aad7890328c Mon Sep 17 00:00:00 2001 From: Bryan Pothon Date: Tue, 24 Mar 2026 17:06:38 +0100 Subject: [PATCH] settings: Fix incorrect worktree root for symlinked settings.json on Windows (#51453) Closes #47007 After #50974, symlinked `settings.json` can be opened and saved, but the worktree ends up rooted at the file itself rather than its parent directory, which causes this error to be logged when changing settings via the settings GUI: ``` 2026-03-18T22:24:05+01:00 ERROR [worktree] ignoring event "C:\\Users\\Bryan\\dev\\bryanpth\\dotfiles\\config\\zed\\settings.json~RF1ab7ae0.TMP" outside of root path "C:\\Users\\Bryan\\dev\\bryanpth\\dotfiles\\config\\zed\\settings.json" ``` Fixed by canonicalizing the symlink path before passing to `open_paths`. Tested with a symlinked settings.json, both directly and through WSL. Release Notes: - Fixed incorrect worktree root when settings.json is a symlink on Windows --- crates/workspace/src/workspace.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 0acc15697008d427efbe0371040a88945b8694c1..8ca13b0eb3b9e334498f4e0e28ed9ad71ed4ac80 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -9198,6 +9198,9 @@ pub fn create_and_open_local_file( .read_with(cx, |project, cx| project.try_windows_path_to_wsl(path, cx)); cx.spawn_in(window, async move |workspace, cx| { let path = path.await?; + + let path = fs.canonicalize(&path).await.unwrap_or(path); + let mut items = workspace .update_in(cx, |workspace, window, cx| { workspace.open_paths(