Closed MangoIV closed 2 months ago
Ah I think this is something to be supported by the hls? What kinda thing are the virtual text then? Why are they not supported by neovim proper? Hmmmm
As always Iām kinda confused
Hey :smile:
inlay hints and code lenses are different LSP requests. It's on the hls roadmap, but I have no idea when it will be done https://github.com/haskell/haskell-language-server/issues/2938.
Activity seems to have picked up recently though.
https://github.com/haskell/haskell-language-server/pull/4131
Thereās a GSOC student working on this!
What kinda thing are the virtual text then?
The virtual text you're seeing are code lenses. It's another LSP specification, which I believe has existed for longer than inlay hints. That would explain why hls implemented a lot of things as code lenses, for which inlay hints would be a better fit today.
The main difference is that code lenses come with an action (e.g., you can evaluate doctest snippets, or add imports or type signatures).
Do you know whatās up with the control sequences and the spaces on code lenses? Is that something that hls does wrong? Or is this something that happens because all of these guys are written for vscode?
I'm not sure. VSCode does display code lenses differently than neovim, because neovim as a tui doesn't support different font sizes. They are a lot smaller in vscode, so I guess that could be the reason.
do you just get these as strings?
haskell-tools doesn't do much, besides enable and auto refresh code lenses by default. The feature itself is implemented in neovim.
interesting, why is it that the standard lsp client doesnāt display these then? Also do you know where Iād have to go with these issues? I e what may cause the visual noise displayed in some of the code lenses?
why is it that the standard lsp client doesnāt display these then?
I think that's just a decision by the maintainer. It could add quite a bit of noise and be too controversial to be enabled by default in neovim core. @mfussenegger, maybe you can answer this better than I can? :smile:
I e what may cause the visual noise displayed in some of the code lenses?
I'm not sure there's a good solution to this, because it would involve overriding vim.lsp.codelens.on_codelens
.
I do this in my personal config, to add a prefix to the title, but I never really noticed any noise - Do you have a concrete example/screen shot?).
That would be too hacky for haskelll-tools though.
this is an example. It has weird amount of spaces, no?
Thereās also the case where it renders āline breaksā in inferred type signatures.
as you can see it inserts these ^@
and then again, a weird amount of spaces :D
Ah, I guess those could be so that it inserts formatted text on multiple lines when you call vim.lsp.codelens.run()
?
I think so, yes, although it has also reliable been messing up these for me š
perhaps one could do something like replacing all consecutive whitespaces by one space in the code lenses? I think that would make it look a lot nicer...
perhaps one could do something like replacing all consecutive whitespaces by one space in the code lenses? I think that would make it look a lot nicer...
Perhaps. But I think this would have to be implemented in neovim core. Overriding the core function is a dirty hack, and would be brittle.
argh, that sucks; I don't know if we want to do this in general, do you think i should open an issue in the neovim repo?
There's an open draft PR that reworks codelens rendering:
That might allow overriding the codelens handler properly once it's done. Until then, I would suggest overriding it in your config.
Yeah, now I only need to find how, thank you for dropping the link :)
https://github.com/neovim/neovim/pull/28807
I went off and fixed it š
package = pkgs.neovim-unwrapped.overrideAttrs (old: {
patches = old.patches or [] ++ [
(pkgs.fetchpatch {
name = "strip-consecutive-white-spaces.patch";
url = "https://github.com/mangoiv/neovim/commit/ea0a9163cb37e8444465b81abbed82c54134c12e.patch";
hash = "sha256-LQwS+yJucin5AlXTPa3O95Zwjw4RerniPtNT8ctw0AU=";
})
];
});
Feature description
It would be super cool if you could support the new lsp inlay hints for code lenses, they look much better than what we have now. I also wonder if there's a possibility to make code lenses look a tad nicer, e.g. not include control sequences and excessive amounts of white space (especially in imports).
This will start working with neovim version 0.10!
Thanks for considering!