clangd
Intro
clangd intellisense and tooling can be used with vim-coc, nvim lsp-clangd, or VSCode C/C++ extension.
On VSCode, we can toggle inlay hints by running “clangd: Toggle inlay hints” from the “commands” prompt (Ctrl+Shift+p or Cmd+Shift+p).
In nvim >= 1.10, check :help lsp-inlay_hint
.
Then set keybinding to enable and disable it at will:
----
-- Toggle LSP Inlay Hints
--
vim.keymap.set(
'n',
'<Leader>ih',
function ()
vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled())
if vim.lsp.inlay_hint.is_enabled() then
status = 'ENABLED'
else
status = 'DISABLED'
end
print('Inlay Hints', status)
end,
{ desc = 'Toggle LSP Inlay Hints' }
)