Skip to content

Share mention disambiguation with tabs and sidebar#57061

Merged
danilo-leal merged 1 commit into
disambiguate-mentionsfrom
share-disambiguation-logic
May 18, 2026
Merged

Share mention disambiguation with tabs and sidebar#57061
danilo-leal merged 1 commit into
disambiguate-mentionsfrom
share-disambiguation-logic

Conversation

@rtfeldman

Copy link
Copy Markdown
Contributor

Replaces the bespoke parent-only disambiguation in MentionUri::disambiguated_name with the shared util::disambiguate::compute_disambiguation_details utility — the same one that drives buffer tab titles, the sidebar, and the recent projects picker.

Why

The current logic only ever appends one parent directory, so two files like /a/src/foo.rs and /b/src/foo.rs both render as src/foo.rs — still ambiguous. The shared utility iteratively bumps a per-item detail level until no two labels collide, handling arbitrary depth and terminating safely at fixed points.

Changes

  • MentionUri::disambiguated_name(needs_disambiguation: bool)disambiguated_name(detail: usize). File/Directory now delegates to project::path_suffix(abs_path, detail). Skill reaches its fixed point at detail >= 1; other variants are fixed points at detail 0.
  • compute_disambiguated_labels in mention_set.rs feeds all mentions into compute_disambiguation_details and maps each to its label at the computed level. All variants are disambiguated against each other (matches what the user sees in the flat list of pills, and matches pane.rs::tab_details).

Tests

  • Added multi-level coverage to test_disambiguated_name for deep file collisions and fixed-point behavior on Thread.
  • All 31 acp_thread mention tests pass; agent_ui builds clean.

Release Notes:

  • N/A

Use util::disambiguate::compute_disambiguation_details for mention labels instead of the bespoke parent-only logic. This is the same utility that drives buffer tab titles, the sidebar, and the recent projects picker, so collisions are now resolved with arbitrary path depth (e.g. /a/src/foo.rs and /b/src/foo.rs become a/src/foo.rs and b/src/foo.rs instead of both showing src/foo.rs).
@rtfeldman rtfeldman self-assigned this May 18, 2026
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 18, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label May 18, 2026
@rtfeldman rtfeldman requested a review from danilo-leal May 18, 2026 15:04
@rtfeldman rtfeldman removed their assignment May 18, 2026
@danilo-leal danilo-leal marked this pull request as ready for review May 18, 2026 15:38
@danilo-leal danilo-leal merged commit 08c5a11 into disambiguate-mentions May 18, 2026
42 checks passed
@danilo-leal danilo-leal deleted the share-disambiguation-logic branch May 18, 2026 15:39
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 staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants