rust-lang / rust-lang/rust-analyzer

Render end_of_line type hints without preceding colon

Open
#22,305 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-config A-inlay-hints C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer.inlayHints.typeHints.location was added in #21322, the value "end_of_line" leads to the type hint being rendered at the end, including the initial colon unless rust-analyzer.inlayHints.renderColons is set to false. Example: https://github.com/rust-lang/rust-analyzer/issues/4318#issuecomment-3678112247

It would be great if there was a way to disable the colons just for the inlay hints at the end of the line, so you don't have to disable all colons if you don't like the ones for the end_of_line case.

Some users might prefer to have the colon be there (for example to avoid the hint looking like a method chaining hint), so I guess the current behaviour could be kept available or even as default.


Has been mentioned previously:

Maybe it will be kind of weird if the inlay hint is put at the end of the line and still started with ":", I think the text should also be modified with the change of placing way

Originally posted by @Decodetalkers in https://github.com/rust-lang/rust-analyzer/pull/21322#discussion_r3013133281

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the configuration documentation for rust-analyzer.inlayHints.typeHints.location and rust-analyzer.inlayHints.renderColons, then inspect the implementation introduced in #21322. Done means end_of_line type hints can control their preceding colon independently while the existing colon behavior remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.