p00f / clangd_extensions.nvim

Clangd's off-spec features for neovim's LSP client. Use https://sr.ht/~p00f/clangd_extensions.nvim instead
MIT License
448 stars 16 forks source link

Inline inlay_hints causes an Error #42

Closed Scarcy closed 11 months ago

Scarcy commented 11 months ago

Whenever I attempt to set inline = true on the clangd_extensions config, I get this error image

This error does not happen when inline is turned off.

This is my lsp config for context (Without keymappings included):

local lsp_zero = require("lsp-zero")
local lsp_config = require("lspconfig")

lsp_zero.preset("minimal")

lsp_zero.ensure_installed({
    "tsserver",
    "eslint",
    "lua_ls",
})

-- Fix Undefined global 'vim'
lsp_zero.configure("lua_ls", {
    settings = {
        Lua = {
            diagnostics = {
                globals = { "vim" },
            },
        },
    },
})
lsp_zero.skip_server_setup({ "clangd" })

lsp_zero.setup()
require("clangd_extensions").setup({
    server = {
        -- options to pass to nvim-lspconfig
        -- i.e. the arguments to require("lspconfig").clangd.setup({})
    },
    extensions = {
        -- defaults:
        -- Automatically set inlay hints (type hints)
        autoSetHints = true,
        -- These apply to the default ClangdSetInlayHints command
        inlay_hints = {
            inline = true,
            -- 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 refersh of the inlay hints.
            -- You can make this { "CursorMoved" } or { "CursorMoved,CursorMovedI" } but
            -- not that this may cause  higher CPU usage.
            -- This option is only respected when only_current_line and
            -- autoSetHints both are true.
            only_current_line_autocmd = { "CursorMoved, CursorMovedI" },
            -- 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 = "πŸ…ƒ",
            },
            highlights = {
                detail = "Comment",
            },
        },
        memory_usage = {
            border = "none",
        },
        symbol_info = {
            border = "none",
        },
    },
})
Scarcy commented 11 months ago

I see now that it requires nvim v0.10, and I'm on version v0.9.1. I was stupid for not recognizing that

p00f commented 11 months ago

Yes, it does the right thing based on neovim version