Skip to content

Conversation

@asukaminato0721
Copy link
Contributor

@asukaminato0721 asukaminato0721 commented Dec 22, 2025

fix #4318

Added a new rust-analyzer.inlayHints.typeHints.location setting (values inline/end_of_line, default inline) and plumbed it through the server config so clients can request end-of-line placement as described in issue.

Updated the binding-type inlay producer so that when end_of_line is selected it extends the hint range to the end of the surrounding let statement and forces a left pad, which makes the client render the type after the statement terminator.

fix test

clippy
@asukaminato0721 asukaminato0721 marked this pull request as ready for review December 22, 2025 16:32
Copilot AI review requested due to automatic review settings December 22, 2025 16:32
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 22, 2025
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 support for rendering type inlay hints at the end of the line (after the statement terminator) instead of inline immediately after the binding identifier, addressing issue #4318.

Key Changes:

  • Added a new configuration option rust-analyzer.inlayHints.typeHints.location with values inline (default) and end_of_line
  • Extended hint ranges to span to the end of containing statements when end-of-line placement is selected
  • Updated both binding pattern and chaining hint producers to support the new placement option

Reviewed changes

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

Show a summary per file
File Description
editors/code/package.json Adds VS Code configuration setting for type hints location with enum values and descriptions
docs/book/src/configuration_generated.md Adds user-facing documentation for the new configuration option
crates/rust-analyzer/src/config.rs Defines TypeHintsLocation enum, adds config field, maps to IDE layer, and provides JSON schema metadata
crates/rust-analyzer/src/cli/analysis_stats.rs Updates analysis stats CLI to use default Inline placement
crates/ide/src/static_index.rs Updates static index to use default Inline placement and imports TypeHintsPlacement
crates/ide/src/lib.rs Exports TypeHintsPlacement for external use
crates/ide/src/inlay_hints/chaining.rs Implements end-of-line placement for chaining hints by extending range to newline token, adds test coverage
crates/ide/src/inlay_hints/bind_pat.rs Implements end-of-line placement for binding pattern hints by extending range to let statement end, adds test coverage
crates/ide/src/inlay_hints.rs Defines TypeHintsPlacement enum and adds type_hints_placement field to InlayHintsConfig, updates test configs

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

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display type hint inlay hints at the end of the line

2 participants