Skip to content

Commit

Permalink
feat(pack): show custom tailwindcss colors in cmp menu (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
Subjective authored May 12, 2023
1 parent 06fcc36 commit 9b6dfb5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lua/astrocommunity/pack/tailwindcss/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ This plugin pack does the following:
- Adds `css` Treesitter parser
- Adds `tailwindcss` and `cssls` language servers
- Adds `prettierd` and `rustywind` formatters
- Adds `roobert/tailwindcss-colorizer-cmp.nvim` to cmp completion sources
- Adds [`tailwindcss-colorizer-cmp.nvim`](https://github.com/js-everts/cmp-tailwind-colors) to cmp completion sources
9 changes: 6 additions & 3 deletions lua/astrocommunity/pack/tailwindcss/tailwindcss.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ return {
{
"hrsh7th/nvim-cmp",
dependencies = {
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
{ "js-everts/cmp-tailwind-colors", config = true },
},
opts = function(_, opts)
local format_kinds = opts.formatting.format
opts.formatting.format = function(entry, item)
format_kinds(entry, item)
return require("tailwindcss-colorizer-cmp").formatter(entry, item)
if item.kind == "Color" then
item = require("cmp-tailwind-colors").format(entry, item)
return item
end
return format_kinds(entry, item)
end
end,
},
Expand Down

0 comments on commit 9b6dfb5

Please sign in to comment.