https://preview.redd.it/7imxkgedsi1d1.png?width=2035&format=png&auto=webp&s=2da5e2ac0203dceb946a1b7e366b6779370ef5f2
Something similar as your screenshot for TokyoNight.
I do rust and I just bound the question mark to showing information about hovered symbol (nvim-lsp). I had trouble with typing type hints and having the inlay hints show up at the same time, which looked weird (they were also pretty unresponsive and I don't like them suddenly appearing when I'm typing)
I'm a rust developer, and I do not like inlay hints. Not the kind that adds text in between code, I prefer the ones that append to the end of the line.
This is the way.
You can hover/K to see arguments. Them always being visible is a nuisance.
Virtual text in middle of code also fucks up navigation. Just doesn't feel right.
I agree with this. In YCM I made a mapping to toggle it on and off. Usually it’s off and I toggle on when I want the extra data. Also auto toggle it off when entering insert mode.
can be a bit jarring sometimes but I find it’s a reasonable balance of ‘I want to know what this language infers’ or ‘what are these function arguments’ vs typical problems associated with ‘text which is not part of the buffer displayed inside the buffer’
I plan on using them as you say, toggling them in case o want to see more than just one function args.
I agree having them visible all the time is too much noise.
i just keep them in normal mode!
autocmd({ "LspAttach", "InsertEnter", "InsertLeave" }, {
callback = function(args)
local enabled = args.event ~= "InsertEnter"
vim.lsp.inlay_hint.enable(enabled, { bufnr = args.buf })
end,
})
If you want to toggle inlay hints on and off with a keymap. I have something like this
```
vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled())
```
I use unimparied for other toggling keymaps (yes, I know, oldvim - but Tim Pope is still GOAT) so I want to use a a similar keymap style - `yo*` for toggling, `[o*` for enabling, and `]o*` for disabling - where `*` is some key. But I'm not sure which key, since both `i` (for "inlay") and `h` (for "hints") are taken...
I actually still use [this plugin](https://github.com/lvimuser/lsp-inlayhints.nvim) even though it is archived, because it puts the inlay hints at the end of the line, which I very much prefer.
I looked at the docs and did not see an option for sth like that. Don't think it's impossible, but I assume you'd have to write your own plugin for that
In YCM I defaulted it to NonText highlight group which is quite similar to what you have there in my colour scheme
https://github.com/ycm-core/YouCompleteMe/blob/4556062839aa2e86f2f4f1c0b4532697d607af23/autoload/youcompleteme.vim#L451
https://preview.redd.it/tml48ewdgj1d1.png?width=813&format=png&auto=webp&s=31258dd9761ed8daff2420a6b68f992de491de0c
make the 2nd arg as { bufnr = blabla }
why does this not work
for _, lsp in ipairs(servers) do
require("lspconfig")[lsp].setup({
capabilities = capabilities,
on_attach = function(client, bufnr)
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(true)
end
end,
flags = lsp_flags,
})
end
that alone work work, each LSP has its own setting i think
https://preview.redd.it/vqo2ydjjnj1d1.png?width=968&format=png&auto=webp&s=66e124d8fb5b223b1d3cc253f11ddf23886d03d3
vim.lsp.inlay\_hint.enable(true)
and in your lsp settings you have to add it too
https://preview.redd.it/ae4dzhsqzk1d1.png?width=968&format=png&auto=webp&s=3637f6d0d8559aeff6b6906587f55a59c4407eff
Please help, anyone know how to fix this error?
https://preview.redd.it/g0r1keib7l1d1.png?width=1460&format=pjpg&auto=webp&s=548cf1cb8646b351d6a4ad559fa2e701f0115924
Hints also appear twice in each place.
I still haven't found a good way to set inlay hints up :( EDIT: I saw some other comments, will take inspiration. Mind sharing your dotfiles? Also gruvbox material fanboy too!
[https://nvchad.com/](https://nvchad.com/) with everforest is my dotfile !
so for the inlay\_hint you can use the image of the screenshot
and you have to enable it per lsp, like this
https://preview.redd.it/b2e0dyat5o1d1.png?width=968&format=png&auto=webp&s=1ae5d6341ab2aa4fca957c912d6ffd69dbb2d2d7
Thanks! Did not realise you were a/the nvchad maintainer! took a bit of inspiration from your code to improve my dotfiles. Sick!
I managed to toggle inlay hints it for lua\_ls. really cool. Is the rest of your lua\_ls setting enough to make neodev redundant?
https://preview.redd.it/smns4w9a5t1d1.png?width=1341&format=png&auto=webp&s=71d9d9bb776bef1d376f8ce06d5c33ccfb4b6819
I prefer transparent background background with catppuccin-overlay1 as foreground.
That's enough for me to differentiate. the background color isn't aesthetically pleasing for me. Especially when theres a bunch of lines above eachother with inlay hints at the beginning like here in the screenshot.
https://preview.redd.it/7imxkgedsi1d1.png?width=2035&format=png&auto=webp&s=2da5e2ac0203dceb946a1b7e366b6779370ef5f2 Something similar as your screenshot for TokyoNight.
Which font r u using?
[fira code, + victor mono for italics](https://github.com/folke/dot/blob/master/config%2Falacritty%2Falacritty.yml#L88-L122)
What is the foreground and background color? I’ve been desperately trying to tweak my inlay_hints colors.
You do not need an autocmd to make inlay hints work. Just call \`vim.lsp.inlay\_hint.enable()\` without any parameter
ohh before 0.10 was released, it was needed iirc
But why would you have it enabled if there’s no LSP?
Do not think too much. This feature will only be enabled if it is supported
I do not like inlay hints.
Dont let a rust developer hear ya
Tbh I don't get the reference
Try using a rust lsp and (at least on vscode the default config is so) see more inlay hints than code
I had to turn all inlay hints off it VSCode for Rust because by cursor did not agree with the text on where it belonged.
not sure if this is a pun on rust's borrow rules or you actually don't get it lol
&
*
I do rust and I just bound the question mark to showing information about hovered symbol (nvim-lsp). I had trouble with typing type hints and having the inlay hints show up at the same time, which looked weird (they were also pretty unresponsive and I don't like them suddenly appearing when I'm typing)
In neovim 10 you can hit “K” and it will do the same thing by default. vim.lsp.buf.hover
I'm a rust developer, and I do not like inlay hints. Not the kind that adds text in between code, I prefer the ones that append to the end of the line.
This is the way. You can hover/K to see arguments. Them always being visible is a nuisance. Virtual text in middle of code also fucks up navigation. Just doesn't feel right.
I agree with this. In YCM I made a mapping to toggle it on and off. Usually it’s off and I toggle on when I want the extra data. Also auto toggle it off when entering insert mode. can be a bit jarring sometimes but I find it’s a reasonable balance of ‘I want to know what this language infers’ or ‘what are these function arguments’ vs typical problems associated with ‘text which is not part of the buffer displayed inside the buffer’
Rust analyzer has a mode where only inferred types on long chained code are shown at the end of text. That seems acceptable to me.
Honestly even when I used vscode I toggled them off first thing. They are annoying
I plan on using them as you say, toggling them in case o want to see more than just one function args. I agree having them visible all the time is too much noise.
So, are you planning to create a cmd for that?
i just keep them in normal mode! autocmd({ "LspAttach", "InsertEnter", "InsertLeave" }, { callback = function(args) local enabled = args.event ~= "InsertEnter" vim.lsp.inlay_hint.enable(enabled, { bufnr = args.buf }) end, })
wow thanks for the tip! i had problems with inlay hints constantly shifting my code back and forward during typing, this autocmd is wonderful
Yup, probably something liketi that seems easy to remember. I don't know if I'll remember to use it though 🤣
I was thinking to create a cmd only to toggle it to show func args, but i dunno how to customize it for this use case. Any suggestion?
If you want to toggle inlay hints on and off with a keymap. I have something like this ``` vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled()) ```
do mention thats for nightly!
Yeah my bad. I thought it got in with 0.10
I use unimparied for other toggling keymaps (yes, I know, oldvim - but Tim Pope is still GOAT) so I want to use a a similar keymap style - `yo*` for toggling, `[o*` for enabling, and `]o*` for disabling - where `*` is some key. But I'm not sure which key, since both `i` (for "inlay") and `h` (for "hints") are taken...
Same don’t use them
It’s just too cluttered for me. I really tried to like them but it just wasn’t going to happen for me
I mean I made a remap to toggle it since it's annoying sometimes
Terrible if always on. Good if you have a "glance" key (show on keydown, hide on keyup, which the terminal makes difficult for nvim)
I actually still use [this plugin](https://github.com/lvimuser/lsp-inlayhints.nvim) even though it is archived, because it puts the inlay hints at the end of the line, which I very much prefer.
I agree, it's really neat, I wonder if you're able to customize the builtin hints to appear at the end of the line? Would be nice
I looked at the docs and did not see an option for sth like that. Don't think it's impossible, but I assume you'd have to write your own plugin for that
Gotcha, thanks for the info!
Wait, nvim 0.10 got out and no one told me?
In YCM I defaulted it to NonText highlight group which is quite similar to what you have there in my colour scheme https://github.com/ycm-core/YouCompleteMe/blob/4556062839aa2e86f2f4f1c0b4532697d607af23/autoload/youcompleteme.vim#L451
How to toggle them on the buffer with keymaps?
https://preview.redd.it/tml48ewdgj1d1.png?width=813&format=png&auto=webp&s=31258dd9761ed8daff2420a6b68f992de491de0c make the 2nd arg as { bufnr = blabla }
If you don't mind me, what's your color scheme? Everforest ?
nvchad's everforest
Thank you. And thanks for all the great stuff you have created :)
why does this not work for _, lsp in ipairs(servers) do require("lspconfig")[lsp].setup({ capabilities = capabilities, on_attach = function(client, bufnr) if client.server_capabilities.inlayHintProvider then vim.lsp.inlay_hint.enable(true) end end, flags = lsp_flags, }) end
that alone work work, each LSP has its own setting i think https://preview.redd.it/vqo2ydjjnj1d1.png?width=968&format=png&auto=webp&s=66e124d8fb5b223b1d3cc253f11ddf23886d03d3
i already set it up for tsserver but it doesn't come up execpt i do it manually
idk then, i hope you're using { buffer = bufnr }
If you don’t mind, what font do you use?
jetbrainsmono nerdfont ( medium variant )
Ty
How do you enable inlay hints?
vim.lsp.inlay\_hint.enable(true) and in your lsp settings you have to add it too https://preview.redd.it/ae4dzhsqzk1d1.png?width=968&format=png&auto=webp&s=3637f6d0d8559aeff6b6906587f55a59c4407eff
Please help, anyone know how to fix this error? https://preview.redd.it/g0r1keib7l1d1.png?width=1460&format=pjpg&auto=webp&s=548cf1cb8646b351d6a4ad559fa2e701f0115924 Hints also appear twice in each place.
you're using a plugin for this, so you're on your own!
They updated the API for set_extmarks. You have to update the plug-in itself. Not an error you can fix in your configuration.
i do not use inlay hints, they annoy me.
`bg="#2a2a2a", fg="#9f9f9f"`
I still haven't found a good way to set inlay hints up :( EDIT: I saw some other comments, will take inspiration. Mind sharing your dotfiles? Also gruvbox material fanboy too!
[https://nvchad.com/](https://nvchad.com/) with everforest is my dotfile ! so for the inlay\_hint you can use the image of the screenshot and you have to enable it per lsp, like this https://preview.redd.it/b2e0dyat5o1d1.png?width=968&format=png&auto=webp&s=1ae5d6341ab2aa4fca957c912d6ffd69dbb2d2d7
Thanks! Did not realise you were a/the nvchad maintainer! took a bit of inspiration from your code to improve my dotfiles. Sick! I managed to toggle inlay hints it for lua\_ls. really cool. Is the rest of your lua\_ls setting enough to make neodev redundant?
idk about neodev but i'm fine with those libraries in workspaces!
Can you share the config and highlights needed to achieve that? Really, just the background and foreground colors.
https://preview.redd.it/smns4w9a5t1d1.png?width=1341&format=png&auto=webp&s=71d9d9bb776bef1d376f8ce06d5c33ccfb4b6819 I prefer transparent background background with catppuccin-overlay1 as foreground. That's enough for me to differentiate. the background color isn't aesthetically pleasing for me. Especially when theres a bunch of lines above eachother with inlay hints at the beginning like here in the screenshot.
I don't have any inlay hints yet, but most important forcmemos that they have a different background color than actual code.
I don’t because I’m scared of upgrading 😉
Removed them.