Map canonical LSP paths into symlinked external directories (#64895)

## Summary

Some language servers report files inside a symlinked directory by their
canonical path. For example, with `/project/pkg -> /shared/pkg`, the
server returns `/shared/pkg/other.rs` instead of
`/project/pkg/other.rs`. Zed found no worktree for that path, so it
opened the file in a new worktree.

Now, if the path matches no worktree, Zed checks it against the
symlinked directories that each worktree has scanned. It maps the
canonical path back to its path in the worktree (`pkg/other.rs`). Those
mappings exist only after scanning, so if no match is found, the lookup
waits for scanning worktrees to finish and tries once more.


The mapping code already existed inside `BackgroundScanner`. I moved it
to `LocalSnapshot::relative_path_for_external_abs_path` so both places
use it.

## Testing

- Added tests for the default `scan_symlinks` setting and for
`scan_symlinks: always`.

To reproduce manually: create a project with a symlink to a directory
outside it, open a file that uses code from that directory, and run "go
to definition" on a symbol defined there.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] ~~UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).~~ No UI
changes.
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed files in symlinked directories opening in a separate worktree
when a language server reports them by their canonical path.
66432e4ca9Sergey Sitnikov committed on 9/30/2026, 6:35:02 PM· committed by GitHubparent8bbcd83
4 files changedLine totals unavailable