NvChad / base46

NvChad's base46 theme plugin with caching ( Total re-write )
Other
206 stars 201 forks source link

Highlights not being applied #182

Closed mikededo closed 1 year ago

mikededo commented 1 year ago

Describe the bug

I have defined custom highlights and after a recent update they have stopped being applied. Also, when opening a file, it is partially rendered with the expected highlights but after they are changed. I have not been able to determine when does that happen (I guess when the computer is more busy, as it takes more time to apply highlights).

To Reproduce

Here is my chadrc.lua and my highlights.lua

Expected behavior

To see the customized highlights.

Desktop (please complete the following information):

siduck commented 1 year ago

TS* highlight groups are removed btw, treesitter now uses "@constant" etc

mikededo commented 1 year ago

Ah, I will take a look into it.

mikededo commented 1 year ago

I can't get it working.

This is what I can see in the telescope preview, which has the expected colors:

image

However, when opening the file colors are not correct:

image

Any ideas?

mikededo commented 1 year ago

It seems related with LSP. Once it finishes loading, it updates the colors. I have checked it by running LspRestart. Colors are correct but when finished it changes back to incorrect.

siduck commented 1 year ago

hi @mikededo did you update semantic tokens in chadrc? also did u update nvchad to the latest and all plugins too?

chikko80 commented 1 year ago

@siduck

I have lsp overrides in my highlights.lua. They completely stopped working. How can i fix this? I don't really get the idea why they are now linked to Treesitter groups

---@type Base46HLGroupsList
M.override = {
  ["@lsp.type.method"] = { fg = "#61AFEF" },
  ["@lsp.type.decorator"] = { fg = "#61AFEF" },
  ["@lsp.type.variable"] = { fg = "#B1B8C4" },
  ["@lsp.type.parameter"] = { fg = "#D19A66" },
  ["@lsp.type.struct"] = { fg = "#E5C07B" },
  ["@lsp.type.namespace"] = { fg = "#E5C07B" },
  ["@lsp.type.property"] = { fg = "#D5B3FF" },
  ["@lsp.type.enumMember"] = { fg = "#56B6C2" },
  ["@lsp.type.interface"] = { fg = "#2ACFAB" },
  ["@lsp.type.macro"] = { fg = "#D19A66" },
}
siduck commented 1 year ago

@chikko80 check default_config.lua file, there's an option for semantic tokens, enable that in chadrc

chikko80 commented 1 year ago

@siduck i have that enabled. You added this option at 10th april. But since 12th of april, or as soon as i update base46 plugin, the colors doesn't work anymore

siduck commented 1 year ago

@siduck i have that enabled. You added this option at 10th april. But since 12th of april, or as soon as i update base46 plugin, the colors doesn't work anymore

Ok add this to each of your hl groups , link="",

mikededo commented 1 year ago

In my case, I have everything up to date, NvChad and plugins.

chikko80 commented 1 year ago

@siduck i have that enabled. You added this option at 10th april. But since 12th of april, or as soon as i update base46 plugin, the colors doesn't work anymore

Ok add this to each of your hl groups , link="",

Works after clearing cache

mikededo commented 1 year ago

@chikko80, rm -rf ~/.cache/nvim? I will try that and reinstall the plugins. But it is kind of strange.

mikededo commented 1 year ago

Issue not solved, in my case:

image

As you can see at the top-left of the image, there's the export class... all in purple, when it should be a mix, as the class should be yellow, as in the telescope preview.

mikededo commented 1 year ago

My TS highlights are the following, I looked for them and updated yesterday, hoping it would work:

return {
  Normal = { fg = '#ABB2BF', bg = 'black' },
  StatusLineNC = { fg = '#ABB2BF' },
  DashboardCenter = { fg = '#ABB2BF' },
  DashboardFooter = { fg = '#ABB2BF' },
  DashboardHeader = { fg = '#ABB2BF' },
  DashboardShortcut = { fg = '#ABB2BF' },
  IndentBlanklineChar = { fg = '#3F4854' },
  Delimiter = { fg = '#ABB2BF' },
  ['@punctuation.delimiter'] = { fg = '#ABB2BF' },
  ['@punctuation.bracket'] = { fg = '#ABB2BF' },
  ['@punctuation.special'] = { fg = '#ABB2BF' },
  ['@attribute'] = { fg = '#E06C75' },
  ['@field'] = { fg = '#E06C75' },
  ['@symbol'] = { fg = '#E5C07B' },
  ['@namespaces'] = { fg = '#E5C07B' },
  ['@property'] = { fg = '#E06C75' },
  ['@constant'] = { fg = '#D19A66' },
  ['@tag.attribute'] = { fg = '#E5C07B' },
}

Any idea or other thing I could try?

chikko80 commented 1 year ago

@mikededo

rm -rf ~/.local/share/nvim
rm -rf ~/.local/state/nvim
mikededo commented 1 year ago

I did run rm -rf ~/.local/share/nvim ~/.cache/nvim, reinstalled everything and the problem persists 😞

siduck commented 1 year ago

@mikededo add link = "" to all of your highlight groups which are related to syntax, like treesitter etc

alexstrassheim commented 1 year ago

I think I have the same problem. When I put the highlights inside 'chadrc.lua' they work, but when I move them to 'highlights.lua' the colors don't work anymore either. I also tried it with link = "" to my highlight groups, but also without success. lsp_semantic_tokens = true is also active 🤔. Screenshot 2023-04-18 at 10 10 22

siduck commented 1 year ago

I think I have the same problem. When I put the highlights inside 'chadrc.lua' they work, but when I move them to 'highlights.lua' the colors don't work anymore either. I also tried it with link = "" to my highlight groups, but also without success. lsp_semantic_tokens = true is also active thinking. Screenshot 2023-04-18 at 10 10 22

are you using windows by any chance?

mikededo commented 1 year ago

Not me

alexstrassheim commented 1 year ago

are you using windows by any chance?

Also not me

siduck commented 1 year ago

@mikededo link="" for your syntax related hl groups

mikededo commented 1 year ago

Doesn't solve the issue 😢

siduck commented 1 year ago

:/

i'll try it tonight

siduck commented 1 year ago

https://user-images.githubusercontent.com/59060246/233848073-53257c8a-fd42-4beb-9087-e5da6bb7d9f8.mp4

@mikededo unable to reproduce the error at all. Please make sure you had uptodate nvchad and other plugins

alexstrassheim commented 1 year ago

@siduck I probably had a typo at some point. The highlights work for me now too. Thanks for your support 👍

mikededo commented 1 year ago

@siduck I have everything up to date, I will look into it. Have you tried with the tsserver? It is what I normally work with and breaks.

siduck commented 1 year ago

@siduck I have everything up to date, I will look into it. Have you tried with the tsserver? It is what I normally work with and breaks.

Please make sure you have semantic stuff not enabled

mikededo commented 1 year ago

How can I validate that?

siduck commented 1 year ago

How can I validate that?

show core/default.config.lua and your chadrc

mikededo commented 1 year ago

I don't have a core/default.confg.lua.

The .chadrc is:

local M = {}

-- local ui = require('NvChad/ui.nvim')

-- Theme and colors
M.ui = {
  theme = 'onedommed',
  transparency = false,
  hl_override = require('custom.highlights'),
  nvdash = {
    load_on_startup = true,
    header = {
      '⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⣤⣤⣴⣦⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ',
      '⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⣿⠿⠿⠿⠿⣿⣿⣿⣿⣶⣤⡀⠀⠀⠀⠀⠀⠀ ',
      '⠀⠀⠀⠀⣠⣾⣿⣿⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣶⡀⠀⠀⠀⠀ ',
      '⠀⠀⠀⣴⣿⣿⠟⠁⠀⠀⠀⣶⣶⣶⣶⡆⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣦⠀⠀⠀ ',
      '⠀⠀⣼⣿⣿⠋⠀⠀⠀⠀⠀⠛⠛⢻⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣧⠀⠀ ',
      '⠀⢸⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⡇⠀ ',
      '⠀⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⠀ ',
      '⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⡟⢹⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⣹⣿⣿⠀ ',
      '⠀⣿⣿⣷⠀⠀⠀⠀⠀⠀⣰⣿⣿⠏⠀⠀⢻⣿⣿⡄⠀⠀⠀⠀⠀⠀⣿⣿⡿⠀ ',
      '⠀⢸⣿⣿⡆⠀⠀⠀⠀⣴⣿⡿⠃⠀⠀⠀⠈⢿⣿⣷⣤⣤⡆⠀⠀⣰⣿⣿⠇⠀ ',
      '⠀⠀⢻⣿⣿⣄⠀⠀⠾⠿⠿⠁⠀⠀⠀⠀⠀⠘⣿⣿⡿⠿⠛⠀⣰⣿⣿⡟⠀⠀ ',
      '⠀⠀⠀⠻⣿⣿⣧⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⠏⠀⠀⠀ ',
      '⠀⠀⠀⠀⠈⠻⣿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⠟⠁⠀⠀⠀⠀ ',
      '⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⠀⠀ ',
      '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⠛⠛⠛⠛⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ',
    },
  },
  cmp = {
    style = 'flat_dark',
    selected_item_bg = 'colored',
  },
  statusline = require('custom.configs.statusline'),
}

M.plugins = 'custom.plugins'

return M
siduck commented 1 year ago

lua/core/default_config.lu @mikededo

mikededo commented 1 year ago
local M = {}

M.options = {
  nvchad_branch = "v2.0",
}

M.ui = {
  ------------------------------- base46 -------------------------------------
  -- hl = highlights
  hl_add = {},
  hl_override = {},
  changed_themes = {},
  theme_toggle = { "onedark", "one_light" },
  theme = "onedark", -- default theme
  transparency = false,
  lsp_semantic_tokens = false, -- needs nvim v0.9, just adds highlight groups for lsp semantic tokens

  -- https://github.com/NvChad/base46/tree/v2.0/lua/base46/extended_integrations
  extended_integrations = {}, -- these aren't compiled by default, ex: "alpha", "notify"

  -- cmp themeing
  cmp = {
    icons = true,
    lspkind_text = true,
    style = "default", -- default/flat_light/flat_dark/atom/atom_colored
    border_color = "grey_fg", -- only applicable for "default" style, use color names from base30 variables
    selected_item_bg = "colored", -- colored / simple
  },

  telescope = { style = "borderless" }, -- borderless / bordered

  ------------------------------- nvchad_ui modules -----------------------------
  statusline = {
    theme = "default", -- default/vscode/vscode_colored/minimal
    -- default/round/block/arrow separators work only for default statusline theme
    -- round and block will work for minimal theme only
    separator_style = "default",
    overriden_modules = nil,
  },

  -- lazyload it when there are 1+ buffers
  tabufline = {
    show_numbers = false,
    enabled = true,
    lazyload = true,
    overriden_modules = nil,
  },

  -- nvdash (dashboard)
  nvdash = {
    load_on_startup = false,

    header = {
      "           ▄ ▄                   ",
      "       ▄   ▄▄▄     ▄ ▄▄▄ ▄ ▄     ",
      "       █ ▄ █▄█ ▄▄▄ █ █▄█ █ █     ",
      "    ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █     ",
      "  ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄  ",
      "  █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄",
      "▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █",
      "█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █",
      "    █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█    ",
    },

    buttons = {
      { "  Find File", "Spc f f", "Telescope find_files" },
      { "  Recent Files", "Spc f o", "Telescope oldfiles" },
      { "  Find Word", "Spc f w", "Telescope live_grep" },
      { "  Bookmarks", "Spc b m", "Telescope marks" },
      { "  Themes", "Spc t h", "Telescope themes" },
      { "  Mappings", "Spc c h", "NvCheatsheet" },
    },
  },

  cheatsheet = { theme = "grid" }, -- simple/grid

  lsp = {
    -- show function signatures i.e args as you type
    signature = {
      disabled = false,
      silent = true, -- silences 'no signature help available' message from appearing
    },
  },
}

M.plugins = "" -- path i.e "custom.plugins", so make custom/plugins.lua file

M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options

M.mappings = {}

return M

I guess it is the default, as I haven't touched anything.

siduck commented 1 year ago

hmmm idk then, i cant produce your issue :(

mikededo commented 1 year ago

No worries, I will dig into it when I have more time! Thanks anyway

siduck commented 1 year ago

@mikededo try the example_config as your custom dir and add your hl_override there

just tried with a minimal chadrc, and it works

look https://0x0.st/HK9-.mp4

mikededo commented 1 year ago

Finally solved the issue. When you said it had to be something regarding lsp highlights, I was quite certain it had to be because of that, as the configs were ok. I found this reddit post: https://www.reddit.com/r/neovim/comments/109vgtl/how_to_disable_highlight_from_lsp/

Adding this line to the on_attach function:

local on_attach = function(client, bufnr)
  client.server_capabilities.semanticTokensProvider = nil -- <- Disable LSP tokens
  -- ...
en
siduck commented 1 year ago

Reference i

btw we already had that!!

image