Skip to content

Commit

Permalink
feat(nvim-highlight-colors): add nvim-cmp completion integration
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Jun 30, 2024
1 parent 899d0bd commit 90ff9f2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lua/astrocommunity/color/nvim-highlight-colors/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,25 @@ return {
},
opts = { enabled_named_colors = false },
},
{
"hrsh7th/nvim-cmp",
optional = true,
opts = function(_, opts)
if not opts.formatting then opts.formatting = {} end
local formatter = vim.tbl_get(opts, "formatting", "format")
opts.formatting.format = function(entry, item)
if formatter then
local color_item = require("nvim-highlight-colors").format(entry, { kind = item.kind })
item = formatter(entry, item)
if color_item.abbr_hl_group then
item.kind_hl_group = color_item.abbr_hl_group
item.kind = color_item.abbr
end
else
item = require("nvim-highlight-colors").format(entry, item)
end
return item
end
end,
},
}

0 comments on commit 90ff9f2

Please sign in to comment.