Closed judaew closed 11 months ago
I think this is too frequent to do without a debounce, and I don't want to implement debounce (because neovim nightly already has this)
You can either
on_attach
)Thanks @p00f!
I'll leave here a guide for other users. This is the minimum config to enable inlay hints for Neovim 0.10.0 (not released yet):
local on_attach = function(client, bufnr)
-- here is your attach conf
-- enable inlay hint
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint(bufnr, true)
end
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
local servers = {
clangd = {
cmd = { vim.fn.exepath("clangd"),
-- here is your clangd command line args
}
}
for i in pairs(servers) do
require("lspconfig")[i].setup({
capabilities = capabilities,
on_attach = on_attach,
settings = servers[i]
})
end
If you are using the clangd_extensions.nvim
plugin, then use the following condition:
for i in pairs(servers) do
if i == "clangd" then
require("clangd_extensions").setup({
server = {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[i]
},
extensions = {
autoSetHints = false,
}
})
else
require("lspconfig")[i].setup({
capabilities = capabilities,
on_attach = on_attach,
settings = servers[i]
})
end
end
That seems correct
I suggest adding a
CursorHold
to the triggers to update the inlay hints immediately. This way, inlay hints will be updated in real time instead of only whenBufWritePost
.See lua/clangd_extensions/inlay_hints.lua#L30.