Skip to content

Disambiguate project names#52848

Merged
rtfeldman merged 19 commits intomainfrom
AI-119/disambiguate-directory-names
Apr 9, 2026
Merged

Disambiguate project names#52848
rtfeldman merged 19 commits intomainfrom
AI-119/disambiguate-directory-names

Conversation

@rtfeldman
Copy link
Copy Markdown
Contributor

@rtfeldman rtfeldman commented Mar 31, 2026

Disambiguate project names in the sidebar (and project picker) so that we don't show e.g. zed, zed but rather foo/zed, bar/zed if the last path component is the same but they are different absolute paths.

Release Notes:

  • N/A

@rtfeldman rtfeldman self-assigned this Mar 31, 2026
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 31, 2026
@zed-community-bot zed-community-bot bot added the staff Pull requests authored by a current member of Zed staff label Mar 31, 2026
@rtfeldman rtfeldman force-pushed the AI-119/fix-visual-test-panics branch from 4de9065 to 9a0e1e7 Compare March 31, 2026 19:53
Three pre-existing issues in the visual test runner were never caught
because visual tests aren't run in CI. Fix all three and add visual
tests to the macOS CI job so they stay healthy going forward.

1. Re-entrant read panic in sidebar creation (3 places): Sidebar::new
   reads the MultiWorkspace entity, so creating it inside a
   multi_workspace.update() closure causes a double-borrow panic.
   Fix by using update_window with root_view.downcast() instead.

2. Tooltip entity leak in breakpoint_hover test: The tooltip system has
   an Rc cycle (ActiveTooltip::Visible holds a check_visible_and_update
   closure that captures the Rc<RefCell<Option<ActiveTooltip>>>). This
   cycle is normally broken when the tooltip is dismissed, but the test
   closed the window while the tooltip was still visible. Fix by
   simulating a click before cleanup to dismiss the tooltip.

3. Visual tests not in CI: Add a cargo_run_visual_tests step to the
   macOS test job via xtask so these tests run on every PR.
@rtfeldman rtfeldman force-pushed the AI-119/fix-visual-test-panics branch from 9a0e1e7 to 29f3459 Compare March 31, 2026 21:29
@rtfeldman rtfeldman force-pushed the AI-119/disambiguate-directory-names branch from 8c9b91e to f9744e6 Compare March 31, 2026 21:33
@rtfeldman rtfeldman changed the title Add visual tests for sidebar project name disambiguation Project name disambiguation Apr 1, 2026
@rtfeldman rtfeldman changed the title Project name disambiguation Disambiguate project names Apr 1, 2026
The baseline images aren't committed yet, so running them fails.
Change the CI step from cargo run to cargo build so we at least
verify the visual test runner compiles on every PR.
Extract the tab disambiguation algorithm from pane.rs into a generic
util::disambiguate module, then use it to disambiguate sidebar project
group names when multiple projects share the same leaf directory name.

The disambiguation works at the individual path level across all groups,
so even a multi-worktree group like 'code/zed + bar/zed' gets each of
its paths disambiguated independently against paths from other groups.

Also adds visual tests covering the two-project and three-project
(with multi-worktree) scenarios.
@rtfeldman rtfeldman force-pushed the AI-119/disambiguate-directory-names branch from 97f0efb to e318f2b Compare April 1, 2026 18:32
Base automatically changed from AI-119/fix-visual-test-panics to main April 2, 2026 03:11
…irectory-names

# Conflicts:
#	crates/sidebar/src/project_group_builder.rs
#	crates/sidebar/src/sidebar.rs
@rtfeldman rtfeldman marked this pull request as ready for review April 7, 2026 11:17
- Optimize path_suffix to use reverse iteration instead of collecting all components
- Remove unused display_name method, rename display_name_from_suffixes to display_name
- Add doc comment warning about fixed-point requirement on compute_disambiguation_details
- Apply disambiguation to project picker (get_recent_projects and get_open_folders)
# Conflicts:
#	crates/sidebar/src/sidebar.rs
When the same path appears in multiple project groups (e.g. /code/zed in
both a 'zed' group and a 'zed, roc' group), the flat_map produced
duplicates that compute_disambiguation_details treated as perpetually
colliding items, driving the detail level to the full absolute path.

Fix by deduplicating paths before disambiguating. Add a regression test
that verifies the correct behavior with the real path_suffix logic.
@rtfeldman rtfeldman merged commit 5d32b56 into main Apr 9, 2026
31 checks passed
@rtfeldman rtfeldman deleted the AI-119/disambiguate-directory-names branch April 9, 2026 18:11
@zed-zippy zed-zippy bot added the PR state:needs review Used to label PRs that are in need of a post-merge approval label Apr 9, 2026
AzureZee added a commit to AzureZee/gpuix that referenced this pull request Apr 10, 2026
AzureZee added a commit to AzureZee/gpuix that referenced this pull request Apr 10, 2026
rtfeldman added a commit that referenced this pull request Apr 10, 2026
Disambiguate project names in the sidebar (and project picker) so that
we don't show e.g. `zed, zed` but rather `foo/zed, bar/zed` if the last
path component is the same but they are different absolute paths.

Release Notes:

- N/A
maxbrunsfeld pushed a commit that referenced this pull request Apr 10, 2026
Disambiguate project names in the sidebar (and project picker) so that
we don't show e.g. `zed, zed` but rather `foo/zed, bar/zed` if the last
path component is the same but they are different absolute paths.

Release Notes:

- N/A
maxbrunsfeld added a commit that referenced this pull request Apr 10, 2026
Cherry-picked PRs (in order applied):

1. #53386
2. #53400
3. #53396
4. #53428
5. #53356
6. #53215
7. #53429
8. #53458
9. #53436
10. #53451
11. #53454
12. #53419
13. #53287
14. #53521
15. #53463
16. #52848
17. #53544
18. #53556
19. #53566
20. #53579
21. #53575
22. #53550
23. #53585
24. #53510
25. #53599
26. #53099
27. #53662
28. #53660
29. #53657
30. #53654


Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Anthony Eid <anthony@zed.dev>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: Eric Holk <eric@zed.dev>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Cameron Mcloughlin <cameron.studdstreet@gmail.com>
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
Co-authored-by: Katie Geer <katie@zed.dev>
Co-authored-by: ojpro <contact@ojpro.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement PR state:needs review Used to label PRs that are in need of a post-merge approval staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant