Open rtaibah opened 4 years ago
I'm not a coc user. Thoughts @benknoble?
@dsifford I’m meaning to look at the coc docs or code to identify the right highlight groups; we can decide then what to do?
From their docs (assuming you're using neoclide/coc.nvim), there are a lot of highlight groups, and I'm not sure exactly which ones are which (I don't use coc, so I don't know what a "Read kind of document symbol" is...). @rtaibah could you experiment with some of these to at least identify which specific groups are causing your issue?
HIGHLIGHTS *coc-highlights*
To customize a highlight, simply use |:highlight| command of Vim in your
vimrc, like: >
" make error texts have a red color
highlight CocErrorHighlight ctermfg=Red guifg=#ff0000
<
Note: don't use `:hi default` for overwriting the highlights.
Note: highlight commands should appear after the |:colorscheme| command or use
|ColorScheme| autocmd to make sure customized highlight works after color
scheme change.
CocErrorSign *CocErrorSign*
Default: `hi CocErrorSign ctermfg=Red guifg=#ff0000`
The highlight used for error signs.
CocWarningSign *CocWarningSign*
Default: `hi CocWarningSign ctermfg=Brown guifg=#ff922b`
The highlight used for warning signs.
CocInfoSign *CocInfoSign*
Default: `hi CocInfoSign ctermfg=Yellow guifg=#fab005`
The highlight used for information signs.
CocHintSign *CocHintSign*
Default: `hi CocHintSign ctermfg=Blue guifg=#15aabf`
The highlight used for hint signs.
CocErrorVirtualText *CocErrorVirtualText*
Default: `hi default link CocErrorVirtualText CocErrorSign`
The highlight used for error signs.
CocWarningVirtualText *CocWarningVirtualText*
Default: `hi default link CocWarningVirtualText CocWarningSign`
The highlight used for warning signs.
CocInfoVirtualText *CocInfoVirtualText*
Default: `hi default link CocInfoVirtualText CocInfoSign`
The highlight used for information signs.
CocHintVirtualText *CocHintVirtualText*
Default: `hi default link CocHintVirtualText CocHintSign`
The highlight used for hint signs.
CocErrorHighlight *CocErrorHighlight*
Default: `hi default link CocErrorHighlight CocUnderline`
The highlight used for error text.
CocWarningHighlight *CocWarningHighlight*
Default: `hi default link CocWarningHighlight CocUnderline`
The highlight used for warning text.
CocInfoHighlight *CocInfoHighlight*
Default: `hi default link CocInfoHighlight CocUnderline`
The highlight used for information text.
CocHintHighlight *CocHintHighlight*
Default: `hi default link CocHintHighlight CocUnderline`
The highlight used for hint text.
CocHighlightText *CocHighlightText*
Default `hi default link CursorColumn`
The highlight used for document highlight feature. Normally used for
highlighting same symbols in the buffer at the current cursor position.
CocHighlightRead *CocHighlightRead*
Default `hi default link CocHighlightRead CocHighlightText`
Highlight for `Read` kind of document symbol.
CocHighlightWrite *CocHighlightWrite*
Default `hi default link CocHighlightWrite CocHighlightText`
Highlight for `Write` kind of document symbol.
CocErrorLine *CocErrorLine*
Default `undefined`
Line highlight of sign for a line that contains error diagnostic.
CocWarningLine *CocWarningLine*
Default `undefined`
Line highlight of sign for a line that contains warning diagnostic.
CocInfoLine *CocInfoLine*
Default `undefined`
Line highlight of sign for a line that contains info diagnostic.
CocHintLine *CocHintLine*
Default `undefined`
Highlight for a line with diagnostic hint.
CocCodeLens *CocCodeLens*
Default: `ctermfg=Gray guifg=#999999`
Highlight group of virtual text for codeLens.
CocFloating *CocFloating*
Default: `Pmenu`
Highlight group of a floating window.
CocErrorFloat *CocErrorFloat*
Default: `hi default link CocErrorFloat CocErrorSign`
The highlight used for a floating window with errors.
CocWarningFloat *CocWarningFloat*
Default: `hi default link CocWarningFloat CocWarningSign`
The highlight used for a floating window with warnings.
CocInfoFloat *CocInfoFloat*
Default: `hi default link CocInfoFloat CocInfoSign`
The highlight used for a floating window with information.
CocHintFloat *CocHintFloat*
Default: `hi default link CocHintFloat CocHintSign`
The highlight used for a floating window with hints.
CocCursorRange *CocCursorRange*
Default: `hi default link CocCursorRange Search`
The highlight used for cursor ranges.
CocHoverRange *CocHoverRange*
Default: `hi default link CocHoverRange Search`
The highlight used for current hover range.
It's unfortunate the coc decided to hard-code the highlight colors for most of the groups, rather than just link them to the related groups so that themes wouldn't have to go back and set them all manually. Boo.
From their docs (assuming you're using neoclide/coc.nvim), there are a lot of highlight groups, and I'm not sure exactly which ones are which (I don't use coc, so I don't know what a "Read kind of document symbol" is...). @rtaibah could you experiment with some of these to at least identify which specific groups are causing your issue?
These two are the ones causing them.
CocErrorSign *CocErrorSign*
Default: `hi CocErrorSign ctermfg=Red guifg=#ff0000`
The highlight used for error signs.
CocInfoSign *CocInfoSign*
Default: `hi CocInfoSign ctermfg=Yellow guifg=#fab005`
The highlight used for information signs.
@rtaibah PRs accepted for this.
See https://github.com/dracula/vim/blob/master/after/plugin/dracula.vim for an example of how (and where) we would do it for coc.
Try to match the default PMenu highlight style if you can.
Tried something like this:
" CoC: {{{
if exists('g:coc_enabled')
hi! CocErrorSign ctermfg=blue guifg=#ff0000
hi CocInfoSign ctermfg=black guifg=#fab005
endif
" }}}
Is not triggering anything.
Try g:did_coc_load
: plugin/coc.vim
echo exists('g:coc_enabled')
returns 1
echo exists('g:did_coc_load: plugin/coc.vim')
returns 0
the second hi
call is missing the bang.
@dsifford Yeah, I was focusing on the first line. Still doesn't matter neither error or info are working.
@rtaibah the variable appears to be did_coc_loaded
not did_coc_load
.
Try that.
https://github.com/neoclide/coc.nvim/blob/master/plugin/coc.vim#L48
And to be clear, you need to write it like this:
if exists('g:did_coc_loaded')
Just to make sure I am doing this right. I am using vim-plug and editing the file dracula.vim
under ~/.vim/plugged/dracula/after/plugin
. The code I currently have is
" CoC: {{{
if exists('g:did_coc_loaded')
hi! CocErrorSign ctermfg=blue guifg=#ff0000
hi! CocInfoSign ctermfg=black guifg=#fab005
endif
" }}}
I exit vim with every edit to make sure the updated plugin is loaded. I expect the font color to change to either blue or black depending on whether its info or error. Am I missing anything?
Try it without the condition. If that still doesn't work then it's not the condition causing the problem.
Good call. Still not working.
Then you probably have the wrong groups targeted. Try some of the others. Or just run the following and look for groups that match what you're trying to target..
:filter Coc hi
I really hate to be a nag, but the target seems fine; the error color changed to green when executed the command in the vim line.
The code and the file location appear on the left.
The error sign is an emoji. You can't recolor that.
My point is that group changed the text to green also.
I’ll try other groups I guess.
I opened an issue (quickly closed though lol) in the coc repo. Basically what they miss is a coloring walkthrough, presumably too performance costly???
Honestly I think that the Magenta default is pretty nice background for documentation and omni. However, when the documentation contains code or content which is text
it is replaced by default String
highlight for this theme which is the same as Magenta, rendering it invisible.
Just reviewing, I wonder if @rtaibah's issue might be due to the way Coc colors--that is, after/plugin
might somehow still be too early? (Ugh)
@JDuchniewicz I'm not entirely sure I follow what your issue is, but I'd like to help fix it--can you give some examples/screenshots/more context/&c.? May be worth opening a separate issue.
You can take a look at the issue linked above ( I think it is related though to this issue):
coc.nvim utilized Pmenu
highlight for its floating windows. One of them (visible on the right in the linked image) is for documentation, which displays usually code which is highlighted as String
which links to Constant
. So, as mentioned above, the colors blend together in this peculiar case.
I have the same issue with "YouCompleteMe". Is there a solution for this problem ?
@mukuntharajaa in general, we need to override the plugin's highlighting if it doesn't link to standard groups. Fortunately you can technically do this yourself (see :help dracula-customization
and :highlight
the offending groups).
If you can come up with customized highlights that fit with Dracula and solve YCM's problem, we'll probably accept a PR baking that in.
Alternately, complain to YCM that their hard-coded highlighting is a poor strategy, and that they should link to standard groups instead :P
What happened
Error & warning are very hard to read with coc plugin.
Screenshot
Machine Info
Darwin MacBook-Pro-5.local 18.7.0 Darwin Kernel Version 18.7.0: Thu Jan 23 06:52:12 PST 2020; root:xnu-4903.278.25~1/RELEASE_X86_64 x86_64
TERM
environment variable:Additional Info