Skip to content

an option for more compact inlay hints #145191

@jhgg

Description

@jhgg

rust-analyzer recently switched to using LSP inlay hints, which render using vscode's inlay hint renderer. with this involves a change in design, and most notably, an introduction of some slight padding around the inlay hint.

in rust-analyzer, inlay hints where it make sense try to look like the actual inferred type definition in many cases, for example:

let i = String::from("hello");

Might insert the following inlay hint:

let i: String = String::from("hello");
     ^^^^^^^^

In vscode today, however, there is some awkward padding around this:

image

In an older rust-analyzer build, this used to look like (taken from r-a's github page which still shows the old style.)

image

An effort can be made to try to reduce the visual impact of the inlay hints by setting editorInlayHint.background and editorInlayHint.foreground - however, this still does not solve the issue of the awkward padding box that is now hidden:

image

This suffers from odd padding on the left/right side, and the bottom.

It would be really much appreciated if vscode could support a "compact" display style option which would remove the padding, border radius and vertical alignment.

The "compact" version might look like this (still probably a pixel or two off, crafted in mspaint..., but should be enough to show the idea)

image

I would be happy to implement this feature too if pointed in the right direction!

Metadata

Metadata

Assignees

Labels

inlay-hintsunder-discussionIssue is under discussion for relevance, priority, approach

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions