mirror of
https://github.com/neovim/neovim.git
synced 2026-03-28 03:12:00 +00:00
feat(lsp): show color preview in completion items #32138
Problem: Color completion items display as plain text without visual preview Solution: Parse RGB/hex colors from documentation and render with colored symbol ■
This commit is contained in:
@@ -171,6 +171,21 @@ describe('vim.lsp.completion: item conversion', function()
|
||||
eq(expected, got)
|
||||
end)
|
||||
|
||||
it('generate "■" symbol with highlight group for CompletionItemKind.Color', function()
|
||||
local completion_list = {
|
||||
{ label = 'text-red-300', kind = 16, documentation = 'color: rgb(252, 165, 165)' },
|
||||
}
|
||||
local result = complete('|', completion_list)
|
||||
result = vim.tbl_map(function(x)
|
||||
return {
|
||||
word = x.word,
|
||||
kind_hlgroup = x.kind_hlgroup,
|
||||
kind = x.kind,
|
||||
}
|
||||
end, result.items)
|
||||
eq({ { word = 'text-red-300', kind_hlgroup = '@lsp.color.fca5a5', kind = '■' } }, result)
|
||||
end)
|
||||
|
||||
---@param prefix string
|
||||
---@param items lsp.CompletionItem[]
|
||||
---@param expected table[]
|
||||
|
||||
Reference in New Issue
Block a user