Type suggestion in vscode and rust-analyzer is not visually friendly

I'm currently using vscode 1.65.2 and rust-analyzer 0.2.985

I have the feeling, that the type hints have changed in their layout.
They currently look like this for me:

and I find that very hard to read, because the type hints are bold with a similar background to something I want to search (connection in this case).

How can I configure the appearance of the type hints or is this something that vscode does?

In the docs they look a lot more decent (although they use the light theme): User Manual

example

How can I achieve that?

rust-analyzer recently switched to upstream inlay hints (meaning native to vscode)

I don't know how much those inlay hints can be customized.

2 Likes

See here to see how to customize the colors.

1 Like

Thanks. The default styling for inlay hints in dark mode are super distracting.

It's VSCode's default styling, so we can't do much about that sadly.

Thanks for all the information.

I found, that you can edit the colors via editorinlayhint.

Maybe I can do something nice with it.

I "solved" this via this settings.json

{
    "workbench.colorCustomizations": {
        "editorInlayHint.background": "#00000000",
        "editorInlayHint.parameterBackground": "#00000000",
        "editorInlayHint.typeBackground": "#00000000"
    },
}

which enables full transparent backgrounds for everything.

Hope this helps some people :slight_smile:

10 Likes

I am a bit confused - anyone with more insight can elaborate on what has changed / who's the culprit here (vscode vs rust-analyzer, vs other?) in regard to imho very drastic usability downgrade?

Previously the code-lenses/hints vere very light and obvious as not being part of real code, while now i find it very cumbersome to identify what is my explicit code, and what is the inlaid hints...

Previously rust-analyzer used it's own lsp extension to provide inlay hints abusing a vscode api. We switched to the new native inlay hint support in lsp and vscode. These native inlay hints look this way. While they do look less nice IMHO they behave better with the cursor. The old implementation would consider the inlay hint part of the previous/following character and as such moving the cursor would jump over them combined. The new implementation considers inlay hints as more of a separate "character" and as such moving the cursor will go from one side to the other without also jumping over the preceding/succeeding character.

1 Like

Thanks for more detailed explanation. I managed to resolve it by setting the extra editorInlayHint foreground to semi-transparent grayish color in addition to "background fix" proposed by people above.

This is more of a meta-suggestion rather than a direct solution, but now that RA is using VSC's built-in inlays, something I've found very helpful to reduce visual clutter is to set "Editor > Inlay Hints: Enabled" to "offUnlessPressed". This makes the inlays invisible except when holding ctrl + alt. The visual state toggles instantly; it feels a lot snappier than IntelliJ's inlay toggling, for example.

Also an update from me: Since version 1.67.0 the color scheme seems to have changed. They blend in better now:

but yes, the hint from @pervognsen is also good. The settingsid is editor.inlayHints.enabled TWIMC :wink: