Требуется neovim 0,7+
Установите этот плагин, используя любой плагин/диспетчер пакетов или см :h packages
Настройте Clangd через LSPConfig/Vim.lsp.Start, как обычно. Вам не нужно звонить require("clangd_extensions").setup если вам нравятся дефолты:
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

Добавьте это в свой nvim-lspconfig / vim.lsp.start() on_attach :
require ( " clangd_extensions.inlay_hints " ). setup_autocmd ()
require ( " clangd_extensions.inlay_hints " ). set_inlay_hints () Вы также можете включить, отключить или переключить намеки с помощью ClangdSetInlayHints , ClangdDisableInlayHints и ClangdToggleInlayHints . Переключение возвращает текущее состояние подсказок, это полезно, если вы хотите подключить обратный вызов, когда переключайте инкрустации:
if require ( " clangd_extensions.inlay_hints " ). toggle_inlay_hints () then
-- Inlay hints are enabled
else
-- Inlay hints are disabled
endНапример, если у вас есть автокомманды, связанные с подсказками Clangd Inlay, вы можете отключить/включить их при переключении намеков на инкрустацию:
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 ,
}
Вы можете сложить узлы с помощью zc и друзей - окно AST имеет shiftwidth=2 и foldmethod=indent .
:ClangdAST для просмотра AST с текущей линией в качестве диапазона :'<,'>ClangdAST с визуальным выбором для просмотра AST с выбранными линиями в качестве диапазона. Посмотрите, как диапазоны обрабатываются по адресу https://clangd.llvm.org/extensions#ast
Использование: для 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 с курсором на желаемом символе.

:ClangdTypeHierarchy с курсором по желаемому типу или символом такого типа. gd с курсором над типом окна, чтобы перейти к его определению.
Вы можете сложить элементы, используя zc и друзей - окно использования памяти имеет shiftwidth=2 и foldmethod=indent . 
:ClangdMemoryUsage . Преамбула может быть большой, поэтому по умолчанию обрушивается, чтобы расширить ее использование :ClangdMemoryUsage expand_preamble
☑ Использование памяти
☑ Аст
☑ Запрос информации о символе
☑ Тип иерархия
☑ инкрустации намеков
☑ переключение между источником/заголовком
☑ Статус файла (см. LSP-status.nvim)
☑ Команды компиляции (могут быть указаны в vim.lsp.start() /lspconfig init_options и settings )
☑ Оценки завершения кода
⬜ Генерация диагностики силы (не уверен)
SIMRAT39 - Код для подсказков Inlay был взят из Rust -Tools.nvim с очень незначительными изменениями.