Skip to content

feat: show full type in tooltips for hints#19640

Closed
roife wants to merge 1 commit intorust-lang:masterfrom
roife:show-full-type-hints
Closed

feat: show full type in tooltips for hints#19640
roife wants to merge 1 commit intorust-lang:masterfrom
roife:show-full-type-hints

Conversation

@roife
Copy link
Member

@roife roife commented Apr 20, 2025

fix #19615.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 20, 2025
@roife roife marked this pull request as draft April 21, 2025 02:25
@roife roife marked this pull request as ready for review April 21, 2025 03:22
@roife
Copy link
Member Author

roife commented Apr 21, 2025

image

@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 5, 2025
@roife roife force-pushed the show-full-type-hints branch from d741cd3 to b9d0401 Compare June 27, 2025 06:33
@roife roife force-pushed the show-full-type-hints branch 2 times, most recently from 406534f to 289c402 Compare July 1, 2025 05:16
@roife roife requested a review from Veykril July 1, 2025 06:13
@roife
Copy link
Member Author

roife commented Jul 1, 2025

Previously, hovering over any part of a hint would display the complete type.

Now, the hidden content is only showed when the mouse hovers over its corresponding ....

image

@roife roife force-pushed the show-full-type-hints branch from c5d3132 to a0dc18e Compare July 17, 2025 05:57
@roife roife requested a review from Veykril July 17, 2025 05:57
Copilot AI review requested due to automatic review settings January 12, 2026 07:49
@roife roife force-pushed the show-full-type-hints branch from bed7a75 to 8ece3e0 Compare January 12, 2026 07:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements tooltips showing full type information when inlay hints are truncated due to length constraints. The implementation adds new methods to the HirWrite trait to handle entering and exiting truncated sections, where the full type is collected as Markdown-formatted tooltip text while displaying an ellipsis ("…") in the inlay hint itself.

Changes:

  • Added start_truncated() and end_truncated() methods to HirWrite trait for managing truncated type display with tooltips
  • Refactored Ty::hir_fmt() to use a new maybe_truncated() helper that wraps type formatting with tooltip collection
  • Enhanced InlayHintLabelBuilder to support storing tooltips alongside truncated parts and prevent location links within truncated sections

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
crates/hir-ty/src/display.rs Core truncation logic: added trait methods, maybe_truncated() helper, refactored Ty::hir_fmt() into write_ty(), updated write_projection() and write_joined() to support tooltips
crates/ide/src/inlay_hints.rs Extended InlayHintLabelBuilder with tooltip tracking, implemented truncation methods that collect full type text as Markdown tooltips, added test configuration constant
crates/ide/src/inlay_hints/bind_pat.rs Added test case hint_truncation_in_type_hint verifying tooltip behavior with nested generic types, updated imports
crates/ide/src/inlay_hints/chaining.rs Added test case shorten_iterator_chaining_hints_truncated verifying tooltip behavior for iterator chains

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@roife
Copy link
Member Author

roife commented Jan 12, 2026

GitHub notifies me with "1 review requesting changes by reviewers," but I can't find where it is :(

l.hir_fmt(f)?;
f.write_char(' ')?;
}
fn write_ty<'db>(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider splitting this function into multiple functions or a separate file, as it is too large?

@ChayimFriedman2
Copy link
Contributor

@Veykril requested changes. As long as he won't send an approval it will stay with the same status (which doesn't prevent merging).

@rustbot
Copy link
Collaborator

rustbot commented Mar 12, 2026

☔ The latest upstream changes (possibly #21804) made this pull request unmergeable. Please resolve the merge conflicts.

@ChayimFriedman2
Copy link
Contributor

Since there was no response from OP, I'm closing this. Please feel free to reopen or open a new PR if you want to resume work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show the collapsed part in tooltips for inlay hints.

5 participants