-
Notifications
You must be signed in to change notification settings - Fork 185
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
Inlay hint #2018
Inlay hint #2018
Conversation
Co-authored-by: jwortmann <jwortmann@outlook.com>
…ugh a keybinding or the command palette with LSP: Toggle Inlay Hints
haven't tested this
to re-fetch the newest inlay hints to avoid showing stale inlay hints.
In order to follow the spec more precisly /** * ... * * *Note* that edits are expected to change the document so that the inlay * hint (or its nearest variant) is now part of the document and the inlay * hint itself is **now obsolete**. * * ... */ textEdits?: TextEdit[]; Phantoms have an id but we cannot rely on that field because it is none at the time of creating the Phantom. It is creted only when the phantom_set is created. Instead attach a custom lsp_uuid field on the phantom
This comment was marked as outdated.
This comment was marked as outdated.
Is it possible to add some settings to let the user select the different font options for inlayhint |
This reverts commit e9dd64c.
I believe that I didn't implement correctly handling of label.commands, so I will remove them. Mosly because I am itrating of label_parts and triggering commands for each label_part, but I think I shul run only one command from the clicked label part.
or the one who do not have text edits but support resolving(this is still not perfect but a better behavior)
@Penguin98kStudio ST "font_face" setting will be respected. |
🙌 |
I wonder if inlay hints should use an increased debounce time. Currently they are forced to use the FEATURES_TIMEOUT defined as 300 ms for the debounce time after text changed. Line 275 in ee8fc6e
VSCode uses 1250 ms, see microsoft/vscode#133730 |
@jwortmann yep, I can see that being an issue. |
The only argument against doing that right now might be the fact that ST UX is kinda broken with those and shorter timeout helps with fixing ST issues faster while typing. For example the phantom doesn't shift to the right when typing right in front of it. |
Another thing I see in the code is that an ongoing request is not canceled when another request is to be made and the response for the previous one hasn't arrived yet. This also means that the result will be drawn unconditionally, despite that the response arrives after more changes in the buffer were made. For semantic tokens I added a line to cancel a pending request whenever a new request is in preparation: Lines 512 to 513 in ee8fc6e
I'm not sure what the expected average/maximum times for inlay hint responses is, but it might be an improvement to also cancel the ongoing request if new changes were made. In fact, according to the linked issue apparently VSCode does it this way. But compared to my implementation of the request canceling for semantic tokens, I think for inlay hints it would be better to move the part shown in the two lines above into Lines 274 to 276 in ee8fc6e
Because at that time we already know that a new request will be made very soon and that the pending results are already outdated and drawing them might make the cursor jump arround annoyingly, so that the resonse should better be ignored instead. |
This PR implements the inlay hints spec.
It will show inlay hints in the view.
It exposes a setting to show/hide inlay hints -
"show_inlay_hints": boolean
.[UPDATED]: The toggle functionality will be left out from this PR:
It exposes a keybinding to toggle that setting:
It exposes a command palette command to toggle that setting:
LSP: Toggle Inlay Hints
Here is an example:
This can be tried with this LSP-volar PR.
closes #1746