Closed ZhiyuanLck closed 3 months ago
Can you make a PR? My distro is still on LLVM 17
This worked for me:
for _, hint in pairs(result) do
local text = ""
for _, labelPart in ipairs(hint.label) do
text = text .. labelPart.value
end
if hint.paddingLeft then text = " " .. text end
if hint.paddingRight then text = text .. " " end
local line = hint.position.line
if line == current_line - 1 or not config.options.inlay_hints.only_current_line then
local col = hint.position.character
vim.api.nvim_buf_set_extmark(bufnr, namespace, line, col, {
virt_text_pos = "inline",
virt_text = {
{ text, config.options.inlay_hints.highlight },
},
hl_mode = "combine",
priority = config.options.inlay_hints.priority,
})
end
end
neovim 0.10 has been released for quite a while now, which has inlay hints built-in. closing this
Logs
reply:textDocument/inlayHint
label
ofreply:textDocument/inlayHint
is no longerstring
but an array of table. https://github.com/p00f/clangd_extensions.nvim/blob/2992ba8c13c2de41f91a7c7488bf1c48bcec31fe/lua/clangd_extensions/inlay_hints.lua#L246-L265