neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.43k stars 954 forks source link

Colors in popup menu #2998

Closed poetaman closed 3 years ago

poetaman commented 3 years ago

Currently all the fields in the popup menu have same color. It would be nice to have each field have its own color, and devicons have their individual colors too.

Given the width of each field is decided by the widest element in that field, a text property solution would be fastest (if text properties are possible in popup).

Screen Shot 2021-03-30 at 3 30 26 PM
poetaman commented 3 years ago

Perhaps an alternative (though slower than text properties) would be to apply a filetype to popup menu's buffer opened by coc, something like this:

let cocpmenuwinid = call popup_menu(a:items, {
     \ 'title': a:title,
     \ 'filter': function('s:QuickpickFilter'),
     \ 'callback': function('s:QuickpickHandler'),
     \ })

call setbufvar(winbufnr(cocpmenuwinid), '&filetype', 'cocpmenu')``

redraw

Then users can use their usual filetype highlight groups from devicons to apply coloring to devicons using other plugins. In any case, setting a filetype for popup window will be beneficial I think.

Note: I am shooting in dark white the code snippet from: https://github.com/neoclide/coc.nvim/blob/5e4dcf72bf47aabb8b579b16812dacdac5b2e77c/autoload/coc/util.vim#L388 Don't know if that's the exact piece of code used to create coc popup menu.

chemzqm commented 3 years ago

It's vim's pum, not popup of vim8, which doesn't provide such kind of support. Report your feature request to vim.

poetaman commented 3 years ago

@chemzqm I reported this to Vim team. Vim's author Bram seems to suggest it is possible to replace pum with popup window: https://github.com/vim/vim/issues/8043#issuecomment-811259848

chemzqm commented 3 years ago

We have to support neovim and exist configuration, that would be too complicated

poetaman commented 3 years ago

@chemzqm Ok, can you comment on the vim ticket, and explain your point to Bram?