Share mention disambiguation with tabs and sidebar#57061
Merged
Conversation
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).
danilo-leal
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the bespoke parent-only disambiguation in
MentionUri::disambiguated_namewith the sharedutil::disambiguate::compute_disambiguation_detailsutility — 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.rsand/b/src/foo.rsboth render assrc/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/Directorynow delegates toproject::path_suffix(abs_path, detail).Skillreaches its fixed point at detail >= 1; other variants are fixed points at detail 0.compute_disambiguated_labelsinmention_set.rsfeeds all mentions intocompute_disambiguation_detailsand 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 matchespane.rs::tab_details).Tests
test_disambiguated_namefor deep file collisions and fixed-point behavior onThread.acp_threadmention tests pass;agent_uibuilds clean.Release Notes: