folke / tokyonight.nvim

🏙 A clean, dark Neovim theme written in Lua, with support for lsp, treesitter and lots of plugins. Includes additional themes for Kitty, Alacritty, iTerm and Fish.
Apache License 2.0
6.25k stars 414 forks source link

bug: Pre-processor directives are changing when clangd is attached. #617

Closed stalmf01 closed 1 month ago

stalmf01 commented 2 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

0.10.0

Operating system/version

Ubuntu 22.04.4

Describe the bug

Pre-processor directives in c with clangd lsp attached are wrong. Below are the wrong colors when the LSP is attached. wrong_colors When the LSP is stoped. correct_colors

Steps To Reproduce

  1. Open a c source with #define
  2. Attach clangd client to a c source file
  3. Colors should change.

Expected Behavior

I would expect the c pre-processor directive and the arguments to be different colors

Repro

I am using lazyvim with the clangd extras on
NamelessDev0000 commented 2 months ago

Well, this is designed in intention. If you don't like this behavior, just change the @lsp.type.macro.cpp highlight group with Constant, which default links to PreProc. 图片

stalmf01 commented 1 month ago

Here is the code to change this.

  {
    "folke/tokyonight.nvim",
    lazy = true,
    opts = {
      style = "night",
      on_highlights = function(highlights, colors)
        highlights["@lsp.type.macro.cpp"] = { fg = colors.orange }
        highlights["@lsp.type.macro.c"] = { fg = colors.orange }
      end,
    },
  },