Requer neovim 0,7+
Instale este plug -in usando qualquer plugin/gerenciador de pacotes ou consulte :h packages
Configure o Clangd via lspconfig/vim.lsp.start, como sempre. Você não precisa ligar require("clangd_extensions").setup se você gosta dos padrões:
require ( " clangd_extensions " ). setup ({
inlay_hints = {
inline = vim . fn . has ( " nvim-0.10 " ) == 1 ,
-- Options other than `highlight' and `priority' only work
-- if `inline' is disabled
-- Only show inlay hints for the current line
only_current_line = false ,
-- Event which triggers a refresh of the inlay hints.
-- You can make this { "CursorMoved" } or { "CursorMoved,CursorMovedI" } but
-- note that this may cause higher CPU usage.
-- This option is only respected when only_current_line is true.
only_current_line_autocmd = { " CursorHold " },
-- whether to show parameter hints with the inlay hints or not
show_parameter_hints = true ,
-- prefix for parameter hints
parameter_hints_prefix = " <- " ,
-- prefix for all the other hints (type, chaining)
other_hints_prefix = " => " ,
-- whether to align to the length of the longest line in the file
max_len_align = false ,
-- padding from the left if max_len_align is true
max_len_align_padding = 1 ,
-- whether to align to the extreme right or not
right_align = false ,
-- padding from the right if right_align is true
right_align_padding = 7 ,
-- The color of the hints
highlight = " Comment " ,
-- The highlight group priority for extmark
priority = 100 ,
},
ast = {
-- These are unicode, should be available in any font
role_icons = {
type = " ? " ,
declaration = " ? " ,
expression = " ? " ,
statement = " ; " ,
specifier = " ? " ,
[ " template argument " ] = " ? " ,
},
kind_icons = {
Compound = " ? " ,
Recovery = " ? " ,
TranslationUnit = " ? " ,
PackExpansion = " ? " ,
TemplateTypeParm = " ? " ,
TemplateTemplateParm = " ? " ,
TemplateParamObject = " ? " ,
},
--[[ These require codicons (https://github.com/microsoft/vscode-codicons)
role_icons = {
type = "",
declaration = "",
expression = "",
specifier = "",
statement = "",
["template argument"] = "",
},
kind_icons = {
Compound = "",
Recovery = "",
TranslationUnit = "",
PackExpansion = "",
TemplateTypeParm = "",
TemplateTemplateParm = "",
TemplateParamObject = "",
}, ]]
highlights = {
detail = " Comment " ,
},
},
memory_usage = {
border = " none " ,
},
symbol_info = {
border = " none " ,
},
}) :ClangdSwitchSourceHeader

Adicione isso ao seu nvim-lspconfig / vim.lsp.start() 's on_attach :
require ( " clangd_extensions.inlay_hints " ). setup_autocmd ()
require ( " clangd_extensions.inlay_hints " ). set_inlay_hints () Você também pode habilitar, desativar ou alternar as dicas com ClangdSetInlayHints , ClangdDisableInlayHints e ClangdToggleInlayHints . A alternativa retorna o estado atual das dicas, isso é útil se você quiser conectar um retorno de chamada ao alternar as dicas de embutimento:
if require ( " clangd_extensions.inlay_hints " ). toggle_inlay_hints () then
-- Inlay hints are enabled
else
-- Inlay hints are disabled
endPor exemplo, se você tiver autocomandos relacionados a dicas de incrustações de clangd, poderá desativá -las/ativar ao alternar dicas de incrustações:
on_attach = function ( _ , buf )
local group = vim . api . nvim_create_augroup ( " clangd_no_inlay_hints_in_insert " , { clear = true })
vim . keymap . set ( " n " , " <leader>lh " , function ()
if require ( " clangd_extensions.inlay_hints " ). toggle_inlay_hints () then
vim . api . nvim_create_autocmd ( " InsertEnter " , { group = group , buffer = buf ,
callback = require ( " clangd_extensions.inlay_hints " ). disable_inlay_hints
})
vim . api . nvim_create_autocmd ({ " TextChanged " , " InsertLeave " }, { group = group , buffer = buf ,
callback = require ( " clangd_extensions.inlay_hints " ). set_inlay_hints
})
else
vim . api . nvim_clear_autocmds ({ group = group , buffer = buf })
end
end , { buffer = buf , desc = " [l]sp [h]ints toggle " })
end ,
}
Você pode dobrar nós usando zc e Friends - A janela AST possui shiftwidth=2 e foldmethod=indent .
:ClangdAST para visualizar o AST com a linha atual como o intervalo :'<,'>ClangdAST com uma seleção visual para visualizar o AST com as linhas selecionadas como intervalo. Veja como os intervalos são tratados em https://clangd.llvm.org/extensions#ast
Uso: para NVIM-CMP
local cmp = require " cmp "
cmp . setup {
-- ... rest of your cmp setup ...
sorting = {
comparators = {
cmp . config . compare . offset ,
cmp . config . compare . exact ,
cmp . config . compare . recently_used ,
require ( " clangd_extensions.cmp_scores " ),
cmp . config . compare . kind ,
cmp . config . compare . sort_text ,
cmp . config . compare . length ,
cmp . config . compare . order ,
},
},
}
:ClangdSymbolInfo com o cursor no símbolo desejado.

:ClangdTypeHierarchy com o cursor sobre o tipo desejado ou um símbolo desse tipo. gd com o cursor sobre um tipo em uma janela para ir à sua definição.
Você pode dobrar itens usando zc e Friends - A janela de uso da memória tem shiftwidth=2 e foldmethod=indent . 
:ClangdMemoryUsage . O preâmbulo pode ser grande, por isso é colapso por padrão, para expandir o uso :ClangdMemoryUsage expand_preamble
☑️ Uso da memória
☑️ AST
☑️ Pedido de informação de símbolo
Hierarquia do tipo
☑️ Dicas de embutimento
☑️ alternar entre fonte/cabeçalho
Status Status do arquivo (consulte LSP-status.nvim)
Comandos Comandos de compilação (podem ser especificados em vim.lsp.start() /lspconfig init_options and settings )
☑️ Pontuações de conclusão de código
⬜ Geração de diagnóstico de força (não tenho certeza)
SIMRAT39 - O código para dicas de embutimento foi retirado de ferramentas de ferrugem.nvim com alterações muito pequenas.