diff options
| author | glepnir <glephunter@gmail.com> | 2026-02-28 23:02:52 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-28 10:02:52 -0500 |
| commit | 3e8a4e10920dc6431547035eec514cdd21e37a3a (patch) | |
| tree | 9cb3027850d8da061ca82cb834a3577acd88eb22 /test/functional/plugin/lsp/completion_spec.lua | |
| parent | c1e60f36f3fb915bb59503dedd330addb63161ac (diff) | |
| download | rneovim-3e8a4e10920dc6431547035eec514cdd21e37a3a.tar.gz rneovim-3e8a4e10920dc6431547035eec514cdd21e37a3a.tar.bz2 rneovim-3e8a4e10920dc6431547035eec514cdd21e37a3a.zip | |
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 ■
Diffstat (limited to 'test/functional/plugin/lsp/completion_spec.lua')
| -rw-r--r-- | test/functional/plugin/lsp/completion_spec.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/completion_spec.lua b/test/functional/plugin/lsp/completion_spec.lua index 27d0de6cba..3f48ec4d91 100644 --- a/test/functional/plugin/lsp/completion_spec.lua +++ b/test/functional/plugin/lsp/completion_spec.lua @@ -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[] |