Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support inlay hints #685

Closed
ulugbekna opened this issue Apr 19, 2022 · 3 comments · Fixed by #1159
Closed

Support inlay hints #685

ulugbekna opened this issue Apr 19, 2022 · 3 comments · Fixed by #1159
Assignees
Labels
enhancement New feature or request

Comments

@ulugbekna
Copy link
Collaborator

ulugbekna commented Apr 19, 2022

Inlay hints support was added to LSP 3.17:

What's an inlay hint?

See https://code.visualstudio.com/docs/languages/typescript#_inlay-hints

What's in it for us?

Having type annotations for local definitions as inlay hints would be very nice.

It's not an urgent but quite useful feature, IMO.

References:

@jfeser jfeser added the enhancement New feature or request label Jun 20, 2023
@jfeser jfeser self-assigned this Jun 20, 2023
@cemerick
Copy link

2¢ after seeing what the inlay hint support looks like via #1159:

  • it really will be great to (probably only occasionally as needed) quickly toggle inlay hints as a way to peek at the types of locals without navigating about. Big 👍 there
  • The loss of what I'll call "aggregated" top-level signature hints (as provided by code lenses until recently ☠️) is a big blow IMO. Having now experienced not having those hints on top levels, I realize just how much I've come to rely on them, and I don't think that inlays will be a good replacement. Most of us are really well-trained to quickly grok function signatures (e.g. foo -> bar -> string -> 'b and so on), and disaggregating them makes inlays relatively less useful in that function context IMO.

Just as an example, the screenshot from @ #1159 (comment) demonstrates what inlays will look like for a top-level function definition:

image

Comparing what needs to be parsed for the inlay approach (including all of the always-variable parameter names, etc):

run rpc: State.t Server.t doc: Document.t ...

seems obviously more difficult to parse than the always-familiar notation for OCaml function signatures, State.t Server.t -> Document.t -> ....

It feels like there's a best of both worlds to be had here: inlays for locals, and the familiar format and display for all function definitions (even local functions, perhaps using line-level lenses?).

(I guess that was more like $2 than 2¢, alas 😳)

@jfeser
Copy link
Collaborator

jfeser commented Jul 14, 2023

I don’t think there’s an issue with keeping the code lenses if people like them. Iirc they were disabled in response to complaints, but a number of people have mentioned that they’d like them back. (Also, they should be possible to enable on the client side. No code has actually been removed; they’re just off by default.)

It’s certainly possible to use both lenses and inlay hints.

@rbjorklin
Copy link

Just chiming in to say I really like code lens and want it to stay. I don’t understand the argument for disabling it in the lsp, in vim I can just disable whether or not to display it with a config option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants