Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Help diagnosing lack of inactive region highlighting with coc-clangd #35

Open
mellery451 opened this issue Jul 2, 2020 · 6 comments
Open

Comments

@mellery451
Copy link

mellery451 commented Jul 2, 2020

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
Copy link
Author

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 mellery451 reopened this Sep 1, 2020
@mellery451 mellery451 changed the title Help diagnosing lack of inactive region highlighting Help diagnosing lack of inactive region highlighting with coc-clangd Sep 1, 2020
@mellery451
Copy link
Author

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
Copy link
Author

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.

@bartlibert
Copy link

This seems to be related: clangd/clangd#132

@0rtz
Copy link

0rtz commented Jan 17, 2021

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

@srs-ch
Copy link

srs-ch commented May 25, 2021

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants