Feature Request: Inlay Hints

Something to add to the pile of feature requests…

A feature available in the Rust Analyzer extension for VS Code is something they’ve termed “inlay hints.” The feature is essentially inline tokens for types, parameter names, etc. Here’s an example, and you can see the hints in gray text:

These hints aren’t a part of the document and can be toggled on/off. Here’s the same code with hints turned off:

Many modern statically-typed languages (and evolving languages like recent Java versions) allow you to skip specifying types for variable assignments and instead the type is interpreted from the assigned value. While a boon to developers wanting to type less, this can also make types unclear when someone else (or yourself later on) review the code. I can get type information from the language server by hovering my mouse, but it’s not ideal to have to hover over every variable one at a time as you’re following a script.

The Rust Analyzer team thought this was so broadly useful that they are suggesting adding it to the LSP spec. There are certainly unlimited use cases for inline, non-document tokens beyond types. Parameter names, deprecations, whether a new dependency version is available, and on and on. A global toggle means someone can easily stop them from cluttering up their view.

I realize this is an extremely complicated request. I do think it could be really useful to a lot of extensions, though.


This is also available for web languages using the following plugin: Inline Parameters for VSCode - Visual Studio Marketplace

I really like the idea, but the execution of the the functionality frustrated me: there was an option to only show the inline hints on the current line the cursor was on, this caused a LOT of code jumping around when moving the cursor between lines, resulting in the cursor position being pushed (you ended up not going down the rows in a straight line, but kept getting pushed to the right).

The problem with keeping the inline hints on display all the time very frequently pushes line-lengths beyond acceptable limits.

Would love to see this option in Nova as well, but perhaps with some thought to the above given with various options to address them.

For the majority of folks who haven’t used Rust Analyzer, RA had a way to toggle displaying hints on/off (which is how I got the above screenshots) so you could turn them all on or off with a key combo. I mostly left them on because the hints updated as I continued to chain methods, which was handy. Others could certainly work the other way, occasionally toggling on for sanity checks.

I thought I’d update this discussion with the current state in early 2023. Inlay Hints are now part of the LSP spec. VS Code at least has upstreamed support, so displaying them or not is now an editor preference instead of an extension preference.

After the (very excellent, very handy) Git Blame inline annotation was added in Nova 10, I’m hopeful that inlining other annotations would be less daunting. I realize that end-of-line and inner-line are different beasts.

I love the font you’re using.

I love it too :grin:. It’s Operator Mono so it was very expensive, but since I spend so much time looking at code I figured I’d get enough value from it.