jackguo380 / vim-lsp-cxx-highlight

Vim plugin for C/C++/ObjC semantic highlighting using cquery, ccls, or clangd
MIT License
337 stars 26 forks source link

Colors doesnt look right after semantic highlighting #58

Closed neerajbadlani closed 2 years ago

neerajbadlani commented 3 years ago

Describe the bug Colors doesnt look right

To Reproduce Install Plugin

Expected behavior Configurable Colors ?

Screenshots Before :

Screen Shot 2021-04-05 at 6 36 13 AM

After :

image

Configuration (Fill this out):

Log File: Enable logging by adding these lines:

let g:lsp_cxx_hl_log_file = '/tmp/lsp-cxx-hl.log'
let g:lsp_cxx_hl_verbose_log = 1

Then post the contents of the log file:

[lsp-cxx-hl.log](https://github.com/jackguo380/vim-lsp-cxx-highlight/files/6258503/lsp-cxx-hl.log)

Additional context Add any other context about the problem here.

yun-cloud commented 3 years ago

Just encounter a similar problem which comes from vim-lsp-cxx-highlight set its own color.

My solution is linking these syntax groups defined by vim-lsp-cxx-highlight into the common highlight groups.

" In vim-lsp-cxx-highlight/syntax/lsp_cxx_highlight.vim

" Syntax Highlighting:
"
" Custom Highlight Groups
" if g:lsp_cxx_hl_light_bg
"     hi default LspCxxHlGroupEnumConstant ctermfg=Magenta guifg=#573F54 cterm=none gui=none
"     hi default LspCxxHlGroupNamespace ctermfg=Yellow guifg=#3D3D00 cterm=none gui=none
"     hi default LspCxxHlGroupMemberVariable ctermfg=Black guifg=Black
" else
"     hi default LspCxxHlGroupEnumConstant ctermfg=Magenta guifg=#AD7FA8 cterm=none gui=none
"     hi default LspCxxHlGroupNamespace ctermfg=Yellow guifg=#BBBB00 cterm=none gui=none
"     hi default LspCxxHlGroupMemberVariable ctermfg=White guifg=White
" endif

hi default link LspCxxHlGroupEnumConstant Constant
hi default link LspCxxHlGroupNamespace Type
hi default link LspCxxHlGroupMemberVariable Identifier

I just sent a pull request #62 to solve this.

jackguo380 commented 3 years ago

You can override the custom groups in syntax/lsp_cxx_highlight.vim without modifying the plugin. There's a reason why highlight has the argument default, it's to allow plugins to define a default and the user can override them.

" Link to another highlight group
hi link LspCxxHlGroupEnumConstant Constant

" or set a specific color
hi LspCxxHlGroupEnumConstant ctermfg=Magenta guifg=#573F54 cterm=none gui=none

Note the lack of default after hi.