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

LSP: support InlayHint, a new feature in LSP Spec 3.17 #18086

Closed
oxalica opened this issue Apr 11, 2022 · 6 comments · Fixed by #23984
Closed

LSP: support InlayHint, a new feature in LSP Spec 3.17 #18086

oxalica opened this issue Apr 11, 2022 · 6 comments · Fixed by #23984
Labels
enhancement feature request lsp
Milestone

Comments

@oxalica
Copy link

oxalica commented Apr 11, 2022

Feature description

The inlay hint feature is stabilized in latest LSP Spec 3.17, and implemented in VSCode.

The latest stable version of rust-analyzer 2022-04-11 already changed the inlay hint interface from the experimental one to the finalized one. Thus it no longer work with nvim's builtin LSP and lsp_extensions.nvim. Since it's not an experimental feature anymore, I think it's better to be implemented inside nvim rather than plugins.

@oxalica oxalica added the enhancement feature request label Apr 11, 2022
@dundargoc dundargoc added the lsp label Apr 11, 2022
@mjlbach
Copy link
Contributor

mjlbach commented Apr 12, 2022

My main motivation for not wanting to do this right now is I'd rather wait for anticonceal to be merged, otherwise we're going to have to hack it with virtual text on the right (how the plugins do it), and it's not really matching the expectation of an inlay hint.

@oxalica
Copy link
Author

oxalica commented Apr 17, 2022

I'd rather wait for anticonceal to be merged, otherwise we're going to have to hack it with virtual text on the right (how the plugins do it)

Personally, I'd like to have a toggle option to show all of them at the end of line like the plugins do, despite they are called "inlay hints", since intrusive hints interleave the code and make it hard to read.

@mjlbach
Copy link
Contributor

mjlbach commented Apr 17, 2022

I think it's likely we would implement that by allowing the user to override the function that places the decorations, similar to how we do with the diagnostic API (by registering a handler). I don't think we'll add a config option.

@leaxoy
Copy link
Contributor

leaxoy commented Apr 28, 2022

LSP 3.17 also has another awesome feature, type hierarchy

@oxalica oxalica changed the title [LSP] [Feature] Support InlayHint, a finalized proposal in LSP Spec 3.17 [LSP] [Feature] Support InlayHint, a new stabilized feature in LSP Spec 3.17 Jul 26, 2022
stefanvanburen added a commit to stefanvanburen/dotfiles that referenced this issue Aug 8, 2022
These aren't actually available in core neovim yet[1]. Just adding them
for when the time comes.

[1]: neovim/neovim#18086
@oxalica
Copy link
Author

oxalica commented Aug 15, 2022

Just a note, I found there are plugins implementing inlay hints now, like
https://github.com/lvimuser/lsp-inlayhints.nvim

@glepnir glepnir mentioned this issue Aug 28, 2022
registerGen added a commit to registerGen/dotfiles that referenced this issue Aug 30, 2022
Also waiting for anticonceal (neovim/neovim#9496) and builtin support
(neovim/neovim#18086)
@neovim neovim deleted a comment from oblitum May 22, 2023
p00f added a commit to p00f/neovim that referenced this issue Jun 11, 2023
Implements debounced automatic refresh of inlay hints,
adds public functions in lsp.lua and docs

Closes neovim#18086
p00f added a commit to p00f/neovim that referenced this issue Jun 11, 2023
Implements debounced automatic refresh of inlay hints,
adds public functions in lsp.lua and docs

Closes neovim#18086
p00f added a commit to p00f/neovim that referenced this issue Jun 11, 2023
Implements debounced automatic refresh of inlay hints,
adds public functions in lsp.lua and docs

Closes neovim#18086
p00f added a commit to p00f/neovim that referenced this issue Jun 11, 2023
Implements debounced automatic refresh of inlay hints,
adds public functions in lsp.lua and docs

Closes neovim#18086
p00f added a commit to p00f/neovim that referenced this issue Jun 11, 2023
Implements debounced automatic refresh of inlay hints,
adds public functions in lsp.lua and docs

Closes neovim#18086
p00f added a commit to p00f/neovim that referenced this issue Jun 11, 2023
This PR adds auto refresh and a public interface on top of neovim#23736

Closes neovim#18086
p00f added a commit to p00f/neovim that referenced this issue Jun 11, 2023
This PR adds automatic refresh and a public interface on top of neovim#23736

Closes neovim#18086
p00f added a commit to p00f/neovim that referenced this issue Jun 11, 2023
This PR adds automatic refresh and a public interface on top of neovim#23736

Closes neovim#18086
p00f added a commit to p00f/neovim that referenced this issue Jun 11, 2023
This PR adds automatic refresh and a public interface on top of neovim#23736

Closes neovim#18086
p00f added a commit to p00f/neovim that referenced this issue Jun 17, 2023
This PR adds automatic refresh and a public interface on top of neovim#23736

Closes neovim#18086
p00f added a commit to p00f/neovim that referenced this issue Jun 19, 2023
This PR adds automatic refresh and a public interface on top of neovim#23736

Closes neovim#18086
@justinmk justinmk changed the title [LSP] [Feature] Support InlayHint, a new stabilized feature in LSP Spec 3.17 LSP: support InlayHint, a new feature in LSP Spec 3.17 Jun 19, 2023
@justinmk justinmk added this to the 0.10 milestone Jun 19, 2023
justinmk pushed a commit that referenced this issue Jun 20, 2023
Add automatic refresh and a public interface on top of #23736

 * add on_reload, on_detach handlers in `enable()` buf_attach, and
  LspDetach autocommand in case of manual detach
* unify `__buffers` and `hint_cache_by_buf`
* use callback bufnr in `on_lines` callback, bufstate: remove __index override
* move user-facing functions into vim.lsp.buf, unify enable/disable/toggle

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

Successfully merging a pull request may close this issue.

6 participants