feat: show full type in tooltips for hints#19640
feat: show full type in tooltips for hints#19640roife wants to merge 1 commit intorust-lang:masterfrom
Conversation
d741cd3 to
b9d0401
Compare
406534f to
289c402
Compare
c5d3132 to
a0dc18e
Compare
bed7a75 to
8ece3e0
Compare
There was a problem hiding this comment.
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()andend_truncated()methods toHirWritetrait for managing truncated type display with tooltips - Refactored
Ty::hir_fmt()to use a newmaybe_truncated()helper that wraps type formatting with tooltip collection - Enhanced
InlayHintLabelBuilderto 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.
|
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>( |
There was a problem hiding this comment.
Should we consider splitting this function into multiple functions or a separate file, as it is too large?
|
@Veykril requested changes. As long as he won't send an approval it will stay with the same status (which doesn't prevent merging). |
|
☔ The latest upstream changes (possibly #21804) made this pull request unmergeable. Please resolve the merge conflicts. |
|
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. |


fix #19615.