brenoprata10 / nvim-highlight-colors

Highlight colors for neovim
654 stars 31 forks source link

nvim-cmp integration not working for flutter Colors #122

Open dizzib opened 1 week ago

dizzib commented 1 week ago

Colors are not highlighted in flutter/dart code, I guess because format item.kind is Field and not Color:

Screenshot 2024-09-04 at 08 55 09

My cmp config:

      formatting = {                                                                                                            
        format = function(entry, item)                                                                                          
          local color_item = require("nvim-highlight-colors").format(                                                           
            entry, { kind = item.kind }                                                                                         
          )                                                                                                                     
          item = require("lspkind").cmp_format({                                                                                
            mode = 'symbol_text', -- show only symbol annotations                                                               
            maxwidth = 50,                                                                                                                                                   
            ellipsis_char = '...',
            show_labelDetails = true,
          })(entry, item)
          if color_item.abbr_hl_group then
            item.kind_hl_group = color_item.abbr_hl_group
            item.kind = color_item.abbr
          end
          -- dedupe: https://github.com/hrsh7th/nvim-cmp/issues/32
          item.dup = ({ buffer = 1, path = 1, nvim_lsp = 0, })[entry.source.name] or 0
          return item
        end
      },