vim-lsp-cxx-highlight icon indicating copy to clipboard operation
vim-lsp-cxx-highlight copied to clipboard

Help diagnosing lack of inactive region highlighting with coc-clangd

Open mellery451 opened this issue 4 years ago • 6 comments

I'm trying to figure out why my inactive regions are not showing as such (lowlighted as comments).

My setup:

 NVIM v0.5.0-2ca8f02a6
 or 
 VIM - Vi IMproved 8.2
 clangd version 10.0.0
 coc.nvim, coc-clangd, and vim-lsp-cxx-highlight are up-to-date

CocInfo:

## Output channel: highlight

[Info  - 5:35:02 PM] Highlight server running in node v14.4.0

## Output channel: clangd log

[17:35:06.092] clangd version 10.0.0
[17:35:06.092] PID: 12415
[17:35:06.092] Working directory: /home/xxxx
[17:35:06.092] argv[0]: /home/linuxbrew/.linuxbrew/bin/clangd
[17:35:06.092] argv[1]: --background-index
[17:35:06.092] argv[2]: --clang-tidy
[17:35:06.092] argv[3]: -j=3
[17:35:06.092] Starting LSP over stdin/stdout
[17:35:06.093] <-- initialize(0)
[17:35:06.093] --> reply:initialize(0) 0 ms
[17:35:06.094] <-- initialized
[17:35:06.094] unhandled notification initialized
[17:35:06.095] <-- textDocument/didOpen
[17:35:06.945] Enqueueing 0 commands for indexing
[17:35:06.987] --> textDocument/clangd.fileStatus
[17:35:06.987] Updating file /home/xxxxx/File.cpp with command inferred from zzzz/other.cpp   g++ ......
[17:35:08.652] --> textDocument/publishDiagnostics
[17:35:08.654] --> textDocument/semanticHighlighting
[17:35:08.655] --> textDocument/clangd.fileStatus

cxx-highlight verbose log:

Wed 01 Jul 2020 05:16:20 PM PDT: lsp_cxx_hl beginning initialization...
Wed 01 Jul 2020 05:16:20 PM PDT: vim-lsp not detected
Wed 01 Jul 2020 05:16:20 PM PDT: LanguageClient-neovim not detected
Wed 01 Jul 2020 05:16:20 PM PDT: coc.nvim successfully registered
Wed 01 Jul 2020 05:16:20 PM PDT: nvim-lsp successfully registered
Wed 01 Jul 2020 05:16:30 PM PDT: textprop nvim notify symbols for tests/image/ImageStreamerTest.cpp
Wed 01 Jul 2020 05:16:30 PM PDT: hl_symbols (textprop nvim) highlighted 415 symbols in file xxx/yyy/FILE.cpp
Wed 01 Jul 2020 05:16:30 PM PDT: operation hl_symbols (textprop nvim) xxx/File.cpp took 0.018496s to complete

I can confirm that some token highlighting is happening (enums and such), but the inactive preprocessor regions are not being lowlighted. What else could I look at to diagnose? FWIW some of the code I'm looking at are #if/#else, so even if my compile flags were wrong, ONE of those regions should be inactive. Advice appreciated.

mellery451 avatar Jul 02 '20 00:07 mellery451

I just did an additional test myself and enabled ccls along with clangd...now I have lowlighting of inactive regions. So I guess it's clangd 10 that is the problem - perhaps this feature is not yet available or will only be released in 11. I will close this now

mellery451 avatar Jul 02 '20 15:07 mellery451

I'm reopening this issue for help specifically figuring out why inactive regions are not showing with clangd. When I change my coc config to enable ccls also, I see the inactive regions - so it's not a matter of incorrect colorscheme at least. When I use ONLY clangd (via coc-clangd), the inactive regions are never shown. I do see other semantic highlights going on, so I'm not sure what I need to debug to figure out what's broken. Is this likely a clangd problem, or an initialization problem perhaps?

mellery451 avatar Sep 01 '20 01:09 mellery451

also, I should mention that clangd is idle after the first few semantic hightlights show-up, so I don't think it's a matter of waiting longer for clangd to complete some indexing..in-fact, clangd is really fast on my system and never seems to be doing much in the background.

mellery451 avatar Sep 01 '20 01:09 mellery451

This seems to be related: https://github.com/clangd/clangd/issues/132

bartlibert avatar Sep 03 '20 12:09 bartlibert

Im using coc.nvim + coc-clangd with clangd version 11.0.0 and can not get highlighting of inactive regions in macros to work aswell, those code regions just do not get LspCxxHlSkippedRegion highlight group, that's unfortunate

0rtz avatar Jan 17 '21 20:01 0rtz

Looks inactive preprocessor regions are highlighted as comments in Clangd 12.0 and I still can't get highlighting of inactive regions in macros to work.

Semantic highlighting

 Inactive preprocessor regions (#ifdef) are highlighted as comments.
 clangd 12 is the last release with support for the non-standard textDocument/semanticHighlights notification. 
 Clients should migrate to the textDocument/semanticTokens request added in LSP 3.16.

srs-ch avatar May 25 '21 07:05 srs-ch