Files
zed/crates/recent_projects
Xin Zhao 43bd5d3cac Persist workspace PathStyle to database (#66465)
## Summary

This PR fixes how recent projects are displayed when a remote project is
on Windows and the Zed client is running on a Unix system. The buggy
example looks like this:
<img width="685" height="253" alt="recent_projects_modal_before"
src="https://github.com/user-attachments/assets/109d056e-908a-4003-9013-ebfecec75dc9"
/>

Again, this happens because we use a `std::path::Path` method to handle
Windows paths on a Unix system. To fix this, we need the `PathStyle`
associated with each workspace. However, recent projects have no live
workspace (they are loaded from the database), so there is no live
`PathStyle` we can query directly. The most direct way to get a reliable
`PathStyle` is to persist it in the workspace DB, so that when recent
projects are loaded from the DB, their `PathStyle` is loaded along with
them.

This PR adds a `path_style` field to `SerializedWorkspace` and a
`path_style TEXT` column to the `workspaces` table, so that `PathStyle`
is persisted to the DB. It also adds an `Option<PathStyle>` field to
`RecentWorkspace`, so that recent project paths can be handled reliably:
local workspaces always use the local path style, and remote rows saved
before this change (which have no stored value) fall back to it. The
actual fix is small: `highlights_for_path()` in
`crates/recent_projects/src/recent_projects.rs` now uses
`PathStyle::file_name(path)` instead of `Path::file_name()`, and its
callers are updated accordingly. For project groups in the current
window, the `PathStyle` is taken from a loaded workspace when available,
falling back to the persisted value otherwise. Since adding the new
column pushes some workspace queries past sqlez's 10-element tuple
limit, each `paths`/`paths_order` column pair is now read as a single
value through a small `PathListColumns` wrapper.

## Testing

New workspace DB tests cover persisting and loading `PathStyle`,
including missing and unrecognized values. The UI fix was tested
locally; see the screenshot below.

## 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).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed recent projects displaying incorrectly for Windows remote
projects when running Zed on macOS or Linux.
2026-11-11 19:08:35 +00:00
..