hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
7.45k stars 370 forks source link

feature-request: allow more control over completion highlight #1887

Open xzbdmw opened 2 months ago

xzbdmw commented 2 months ago

Zed:

截屏2024-04-17 02 45 02

They achieve these beautiful colors by regex substitute completion.details from language server and apply highlight to them.Currently cmp apply different highlight at a fix width, would be great to expose variable-size highlight(the same format as nvim_buf_set_extmark?) interface to users(and full lsp response message).

Edit: they are just concating detail items to fake it into valid treesitter grammer and apply highlight directly using treesitter query. The fake process is fairly easy and already can be done by formatting config. I assume cmp only needs an option to apply treesitter highlights or not for completion items.

xzbdmw commented 2 months ago

quick demo

截屏2024-04-18 09 19 42

image image

Moerliy commented 2 months ago

Would love to see this happen.