I work primarily in Rust where I don't have type information written in the file (the compiler infers the type information for me). I normally rely on the type inlay hints, and in the JetBrains IDEs that I used to use, I could control-click on the type in the hint to go to its definition.
With Neovim, I have my type inlay hints, and the go-to-definition functionality, but I don't have a way to trigger LSP actions on the type information, since it isn't real text in the source file.
Here's a small example of what I'm talking about:
fn main() { let a: i32 = 3; // ^---^ - type inlay hint, virtual text // - if my cursor is there, all LSP actions only // work on the variable itself, not the type } I'm looking for a way to trigger LSP actions (e.g. vim.lsp.buf.type_definition() and vim.lsp.buf.hover()) on the type information in inlay hints, or in the hover window. This would allow me to act on the type information that isn't written in the source file.
I've tried setting virtualedit to allow me to move my cursor inside the inlay hints, but this doesn't work. The LSP actions just work on the variable the hint is for, and not the type in the hint.
I've also tried triggering LSP actions within the hover window, but this doesn't work (presumably because the hover popup isn't attached to the LSP server).
Additionally, I've tried the Lspsaga plugin because it supposedly works for this purpose, but it didn't help. I still couldn't trigger LSP actions within its hover window.
I'm curious how other people handle this use case. I know that in most cases I can run Telescope or something similar to quickly search for the type, but I'm looking for a method that allows me to "chain" LSP actions on subsequent LSP popup windows, like I'm used to from other IDEs.
Any help would be appreciated!
'virtualedit'option is unrelated to the virtualtext feature. It won't help with this problem at all, as you already observed. For future reference,'virtualedit'takes a string, so it would matter what you set it to.allin my testing, which allowed me to move my cursor inside the inlay hints. This is why I mentioned it, since it looked like it might work, though evidently it did not solve the problem.