Skip to content

Add additional (or custom) InlayHintKinds #151920

@DanTup

Description

@DanTup

In Dart, we use Decorations to show the names of constructors/methods alongside their closing parens to make it easier to match them up:

Screenshot 2022-06-13 at 11 03 16

The data for these is provided using custom notifications from the language server. I was hoping with InlayHints I could move these over to something more standard (in LSP). However as I came to implement it, I found InlayHints only have specific kinds for type/parameter placeholders (see InlayHintKind).

While kind is optional, in LSP it says:

/**
	 * The kind of this hint. Can be omitted in which case the client
	 * should fall back to a reasonable default.
	 */

This "reasonable default" suggests that not providing a kind could result in the hints being styled to match types/parameter names, which might not be a great experience.

It would be nice if either there were some additional kinds that could be used for the sorts of annotations shown in the screenshot about, or a way to provide custom kinds (where it's up to the client extension to provide some theming for them).

There's a similar feature called InlineValues that I thought may also work here (specifically InlineValueText), however its description explicitly mentions being debugger related, so it's not sure if they would only appear while debugging (and if not today, whether that's guaranteed in future).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions