-
-
Notifications
You must be signed in to change notification settings - Fork 873
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 for inlay hints for go-mode / gopls #3618
Comments
hi @asg0451 , just wanted to share that I started some work to implement inlay hints and I have tested them with gopls. You can try it out at my branch: https://github.com/jakejx/lsp-mode/tree/inlay-hints. It's still very beta, so please let me know if you encounter any weird issues. It should "just work" when you start lsp-mode. |
@jakejx you know that there is already implementation rust-analyzer and clangd, right? |
@yyoncho oh are those using the official spec? If so I was not aware. |
I think that they were using the same structure but a different method name (or something like that). I am failing to find the issue in which we discussed the unification of the implementations. |
I see. I took quite abit of inspiration from the lap-javascript implementation for my changes. Let me know how I can help to get inlay hints into LSP mode. One thing I have noticed already is gopls returns an empty object for the inlay hint capability which is treated as nil in elisp. |
This is what we do for now until we have core support for fixing this: https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-mode.el#L7403 |
I see. Let me take a look at that and the current rust-analzyer implementation and see which useful parts I can bring over. |
I tried @jakejx 's branch (I applied the "Initial inlay hint support for gopls" commit to current lsp-mode), and it works with clangd. The only modification I had to make is to change a line in - ('string label)
+ ((cl-type string) label) (I'm a lisp noob, not sure this is a correct modification, but it works) @yyoncho you said in your first comment here that lsp-mode already has an implementation for clangd, but I think that's not the case (at least I cannot find it). So jakejx's work is valuable, because it adds inlay hint support not just for go, but for C/C++ as well (and supposedly for all language servers which support the inlay hint protocol). |
@geza-herman I will handle this report |
Draft PR at #3970 I have tested only with javascript/rust analyzer but it should fine. |
Inlay hints just landed in gopls 0.9, but don't seem to work out of the box with lsp-mode. Ideally they would work similarly to rust-analyzer's inlays.
golang/go#52343
golang/go#53412
https://github.com/golang/tools/blob/master/gopls/doc/settings.md#inlayhint
The text was updated successfully, but these errors were encountered: