Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

How can I just only highlight the middle of a conditional compilation #87

Open
Crazyokd opened this issue Aug 27, 2024 · 0 comments
Open

Comments

@Crazyokd
Copy link

Your plugin was very useful when I used vim+coc+ccls in the past.
now I mainly use neovim+ccls because the neovim more fast. I'm mostly using treesitter to provide highlighting because it works so well with my color theme.

When using ccls as my lsp, it doesn't seem to support conditional compilation well enough to provide effective highlighting.
image

When I tried vim-lsp-cxx-hight again, I found that it solves the problem effectively. But it also affects the highlighting of other symbols.
image

So I would like to be able to enable only macro related highlighting and turn off other settings.
I want to know how can I do it?

below is my lsp-config.lua:

return {
  "neovim/nvim-lspconfig",
	dependencies = {
		"hrsh7th/cmp-nvim-lsp",
        {
            "jackguo380/vim-lsp-cxx-highlight",
            ft = { 'c', 'cpp', 'h', 'hpp' }
        }
	},
  config = function()
    local lspconfig = require("lspconfig")
    local capabilities = require("cmp_nvim_lsp").default_capabilities()

    lspconfig.lua_ls.setup {
      capabilities = capabilities,

      settings = {
          Lua = {
              diagnostics = {
                  globals = { "vim" }
              }
          }
      }
    }

    lspconfig.ccls.setup {
      capabilities = capabilities,
      init_options = {
        cache = {
          directory = "/tmp/ccls"
        };
        client = {
          snippetSupport = true
        };
        compilationDatabaseDirectory = "build";
        highlight = {
          lsRanges = true;
        };
        clang = {
          extraArgs = {
            "--query-driver=/usr/bin/gcc,/usr/bin/g++",
            "--gcc-toolchain=/usr",
          };
        };
      }
    }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant