Skip to content

Some groups are not highlighted

Hello! Thank you for the awesone plugin!

I have an issue with highlighting, how it looks:

image

As you can see, highlighting works, but partially. For example, any variable are not highlighted. If I understand correctly from the readme, members should highlighted as a Variable by default.

I tried to specify the following in my vimrc:

augroup ConfigSetup
  autocmd!
  autocmd VimEnter,ColorScheme * runtime syntax/custom_colors.vim
augroup END

syntax/custom_colors.vim:

highlight! default link ClangdField markdownHeadingDelimiter

But still not works.

Here is my configuration:

packadd nvim-lsp
packadd clangd-nvim
lua require'lsp_config'

from nvim-lsp.lua:

local nvim_lsp = require'nvim_lsp'

local apply_settings = function()
  require'diagnostic'.on_attach()

  local map_options = {noremap=true, silent=true}
  vim.api.nvim_buf_set_keymap(0, 'n', 'gd', '<Cmd>lua vim.lsp.buf.declaration()<CR>', map_options)
  vim.api.nvim_buf_set_keymap(0, 'n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', map_options)
  vim.api.nvim_buf_set_keymap(0, 'n', 'gr', '<Cmd>lua vim.lsp.buf.rename()<CR>', map_options)
  vim.api.nvim_buf_set_keymap(0, 'n', 'gR', '<Cmd>lua vim.lsp.buf.references()<CR>', map_options)
  vim.api.nvim_buf_set_keymap(0, 'n', 'gS', '<Cmd>lua vim.lsp.buf.document_symbol()<CR>', map_options)
  vim.api.nvim_buf_set_keymap(0, 'n', 'gW', '<Cmd>lua vim.lsp.buf.workspace_symbol()<CR>', map_options)
  vim.api.nvim_buf_set_keymap(0, 'n', '<A-CR>', '<Cmd>lua vim.lsp.buf.code_action()<CR>', map_options)
  vim.api.nvim_buf_set_keymap(0, 'n', '<A-d>', '<Cmd>lua vim.lsp.util.show_line_diagnostics()<CR>', map_options)
end

nvim_lsp.clangd.setup{
    cmd = {'clangd', '--header-insertion=never', '--suggest-missing-includes', '--background-index', '-j=8', '--cross-file-rename', '--pch-storage=memory', '--clang-tidy', '--clang-tidy-checks=-clang-analyzer-*,bugprone-*,misc-*,-misc-non-private-member-variables-in-classes,performance-*,-performance-no-automatic-move,modernize-use-*,-modernize-use-nodiscard,-modernize-use-trailing-return-type'},
    on_attach = function()
        apply_settings()
        vim.api.nvim_buf_set_keymap(0, 'n', 'gs', '<Cmd>ClangdSwitchSourceHeader<CR>', {noremap=true, silent=true})
    end,
    on_init = require'clangd_nvim'.on_init,
    capabilities = {
        textDocument = {
            completion = {
                completionItem = {
                    snippetSupport = true
                }
            },
            semanticHighlightingCapabilities = {
                semanticHighlighting = true
            }
        }
    },
    init_options = {
        usePlaceholders = true,
        completeUnimported = true
    }
}

I use latest neovim nightly with clangd 10.1.

Edited by Gennadiy Chernyshyk