Skip to content

Clarify expected use for inlayHint/refresh #1546

Open
@DanTup

Description

@DanTup

I'm implementing InlayHints and noticed an issue with them not refreshing in VS Code when I need them to.

file1

final foo = getThing();

file2

String getThing() {}

If I enable inlay hints, file1 gets a String hint on foo to show that the inferred type is Foo.

However, if I modify file2 and change String to int, VS Code does not know to refresh the labels in file1 (I have both files open side-by-side).

It seems like the answer to this is to call inlayHint/refresh, however:

  • It doesn't take a filename, so will refresh them for every single file
  • Doing this essentially on every file modification sounds like it could result in a lot of additional requests
  • The spec makes it sound like we shouldn't be calling this often:
       * Note that this event is global and will force the client to refresh all
       * inlay hints currently shown. It should be used with absolute care and
       * is useful for situation where a server for example detects a project wide
       * change that requires such a calculation.
    

How is this intended to work? What are the responsibilities of the client, and what are the responsibilities of the server to ensure these labels are kept up-to-date when they reference functions from other files?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions