-
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
Look into textDocument/inlayHints #1746
Comments
Inlay hints are now part of the spec. |
Is there any language server which already has support for the inlay hints from the LSP specs? I just did an experimental and untested implementation at https://github.com/jwortmann/LSP/tree/inlay-hints, partly based on the feature in LSP-typescript. Clickable links for the labels are not yet supported, but tooltips should work. According to the specs, the inlay hints can have optional textEdits and commands associated with them too, but I'm not sure how would be a good way to present them in the UI. I guess the linked ST feature request for |
LSP-volar supports inlay hints. (Note, you have to tweak the initialization options in LSP-volar to enable inlay hints, also you have to have a vue app that uses typescript version 4.4.+). |
I think with the current behavior of phantoms having inlay hints display for the user as a background request is not ideal. I was thinking of having this LSP feature be implemented as a foreground feature where the user has to press a key binding to do the request. The same key binding would toggle between “show inlay hints” and “hide inlay hints”. Like a temporary X-ray vision. What do you think? |
I'm not sure about the solution with a key binding. I could imagine that it would work well if there were "key down" and "key up" events in the ST API, so that the inline hints were only active as long as the key is pressed down. But this is not possible with ST key bindings, so the only option would be the toggle on/off. This would more or less be the same as to add or remove |
LSP-gopls will be supporting inlay hints on next release. @jwortmann I like your implementation. I did notice that hints are display until document edit. Is this intentional? I would imagine it triggers on document open? |
Hitting a keybinding twice would be a horrible UX in my eyes. is there a FR open with ST to support Key Down and Key Up? |
Thanks, I will probably try it out with the Go server next weekend. Nice that it seems to work so far, I didn't test my implementation at all ;)
No, just an oversight. Should be easy to fix, so that they appear on document open. I think I have quickly searched through the ST issue tracker for a feature request about key down/up, but didn't find any. There is such functionality for mouse bindings with "press_command" (mouse button down) and "command" (mouse button released), but unfortunately not for key bindings. |
By the way, there is another small problem with Sublime's phantoms when you delete a block of code. Because the new inlay hints from the LSP specs don't have a range, but only a position, the phantoms contained in the deleted code won't be removed until the next response from the server arrives. It's not a terrible or breaking bug, but probably feels a bit laggy when it happens. I had created an issue report for this at sublimehq/sublime_text#5410. And I think this problem was already observed with the rust-analyzer implementation. I think this problem doesn't occur in LSP-typescript, because that language server uses its own inlay hints implementation with a range for the inlay hints. |
Is your feature request related to a problem? Please describe.
I would like to see inlay hints if possible.
Describe the solution you'd like
Implement microsoft/vscode-languageserver-node#772
Additional context
MetaLS has a custom version of this implemented: scalameta/metals-sublime#36
The text was updated successfully, but these errors were encountered: