Skip to content

Conversation

alfiejfs
Copy link

This PR always computes the inlay hints and only displays them if the configuration option is enabled.

I outlined the motivation for this a while ago in this discussion: #13712 but the TL;DR is I often enable/disable type hints, and there is currently a lag as they get computed each time.

I am happy to put "always computing them" behind a config option itself if this is preferable.

@alfiejfs
Copy link
Author

alfiejfs commented Sep 17, 2025

I see the thumbs down and I can understand why. I wonder what the resolution is here for my use case -- I don't think it is unreasonable/uncommon?

I think ultimately what I want is something to have precomputed but not displayed inlay hints. This could come from changing "display-inlay-hints" to have three options (similar to VSC):

  • off
  • on
  • offUnlessPressed

This PR is just a means to get similar functionality, and since the option already exists it is tricky to work around it. But I personally think this is a workflow that Helix should support.

If you haven't tried it/aren't aware of what the issue is, add something like:

[keys.normal.space]
i = ":toggle lsp.display-inlay-hints"

and open a Rust file and toggle it on and off intermittently. You will see the delay I am referring to. When you checkout this 'fix', that mostly disappears (maybe a little latency with toggles sometimes? Wonder why this is -- wouldn't imagine super high latency when not much else is going on?).

@the-mikedavis
Copy link
Member

We shouldn't always compute inlay hints since, if you never use them, it's wasted work. Some configuration to separate displaying and computing them seems alright to me though, to better support the use-case of toggling them often.

@alfiejfs
Copy link
Author

I agree and I am happy to implement. However I am unsure how this looks. I think there are two possibilities:

  1. Add a config option precompute-inlay-hints
  2. Implement an offUnlessPressed option to display-inlay-hints.

My preference is for the latter, but I am unsure if Helix supports this kind of feature easily yet. It is obviously a different mechanism to toggling.

I think the former is not fantastic because I think it adds some complexity/cause for confusion. I think it is not entirely intuitive what the behaviour of the following would be:

display-inlay-hints: true
precompute-inlay-hints: false

I think it makes logical sense, but you have to make assumptions about how they might interact. Which is a layer of complexity the config ideally shouldn't have. But I assume this is just the easiest way forward here.

Let me know what you think 😄

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

Successfully merging this pull request may close these issues.

2 participants