brenoprata10 / nvim-highlight-colors

Highlight colors for neovim
654 stars 31 forks source link

cmp integration background highlight issues #110

Closed nickp-real closed 2 months ago

nickp-real commented 2 months ago

My config

formatting = {
  fields = { "kind", "abbr", "menu" },
  format = function(entry, item)
    item = require("nvim-highlight-colors").format(entry, item)
    -- the item.abbr returns the user's virtual object eg. the square when it's Color entry
    if item.abbr == "" then
      -- I have kind_icons table looks like kind_icons = { Text = "Tt (this is icon)", ...more icons }
      item.kind = string.format("%s", kind_icons[item.menu])
    else
      item.kind = item.abbr
    end
    item.abbr = item.word
    item.kind_hl_group = item.abbr_hl_group or nil
    item.abbr_hl_group = nil
    return item
end,
}

The problem I found is the highlight group (nvim-highlight-000000, ...) doesn't link the bg highlight to the current theme highlight (maybe using the Normal group) and another one is when I have a custom tailwind variable, it doesn't apply eg text-primary

This is the result, some work when you first see it (type the text and it shows) then when scrolling down and scrolling back, the background color turns to the highlight color group instead image

before select item image

after select item image

my config with a custom icon image

Originally posted by @nickp-real in https://github.com/brenoprata10/nvim-highlight-colors/issues/109#issuecomment-2198428197

brenoprata10 commented 2 months ago

Hey o/ I am not really able to reproduce your issue, the scrolling and selection of my vanilla config is working fine. I recommend calling my format function at the very bottom of the nvim-cmp format. Check the README for more info

mehalter commented 2 months ago

Hm I am also getting this 🤔 even with the format being set to only nvim-highlight-colors:

formatting = {
  format = require("nvim-highlight-colors").format
}
mehalter commented 2 months ago

It seems to simply be highlight collisions. Opening a PR now to fix this

brenoprata10 commented 2 months ago

Thanks man! 💯