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

Bug about combine highlight group of LspCxxHlSymMacro and LspCxxHlSymField #38

Closed kevinhwang91 closed 4 years ago

kevinhwang91 commented 4 years ago

Describe the bug https://github.com/neovim/neovim/blob/master/src/nvim/window.c#L1150 image

It seems that LspCxxHlSymMacro makes LspCxxHlSymField overlap the unrelated syntax.

To Reproduce

  1. git clone https://github.com/neovim/neovim.git && cd neovim
  2. build compile_commands.json: bear make CMAKE_INSTALL_PREFIX=$HOME/.local
  3. nvim -u ~/mini.vim src/nvim/window.c +1150

cat ~/mini.vim

set number
call plug#begin('~/.config/nvim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'jackguo380/vim-lsp-cxx-highlight'
call plug#end()

highlight default link LspCxxHlGroupMemberVariable Underlined

Expected behavior Don't overlap the syntax like () , , and ->.

Screenshots If applicable, add screenshots to help explain your problem.

Configuration (Fill this out):

Log File: Log file is so large, if you can't reproduce this issue, I will post it as soon as possible.

jackguo380 commented 4 years ago

Hi kevinhwang91,

I'm assuming you are using ccls. Unfortunately I think this is a ccls problem (which may or may not be caused by libclang).

As seen in the lines above line 1150 the MemberVariable groups are highlighted with the correct positions. vim-lsp-cxx-highlight simply applies a bunch of highlights based on positions given by ccls, if it correctly applied them above 1150 it will do the same on 1150 as well. There are no special interactions between highlight group and positions.

I'm guessing the ccls bug to do with generating the correct highlighting after preprocessing a macro which is a pretty complex task. Maybe if I find some time I'll try to PR a fix for this over in ccls, but no guarentees on that. You can also file an issue on ccls' side, but please first produce the bug using the vscode plugin as well just for confirmation.

kevinhwang91 commented 4 years ago

Yes, I'm using ccls. Thanks for your explanation. Look like an upstream issue, you can close this issue any time.