chromatica.nvim
chromatica.nvim copied to clipboard
Libclang does not find its include directory on Linux
On Linux (tested it on Debian buster), libclang does only search for system headers in the default system locations but not in clang's own include directory /usr/lib/llvm-6.0/lib/clang/6.0.0/include (the version depends on the installed clang package). This directory for example contains stddef.h, so chromatica currently cannot highlight common types like size_t. A simple workaround for this issue is adding clang's include directory to the global chromatica flags:
let g:chromatica#global_args = ['-isystem/usr/lib/llvm-6.0/lib/clang/6.0.0/include']
On macos, I did not experience such problems. Maybe Apple's libclang got some patches to read all include directories.
In my opinion, that is actually a libclang issue but users of chromatica should know about this (maybe a hint in the README file?). YouCompleteMe, which is also libclang based, brings its own copy of clang headers to avoid this issue. They have a very long issue about libclang search path problems.
Thank you for the tip: I was experiencing the same issue and pulling my hair off trying to figure out what was going on! :slightly_smiling_face:
@IngoHeimbach, thanks a lot for the tip! After adding
let g:chromatica#global_args = ['-isystem/usr/lib/clang/8.0.0/include']
the syntax highlighting improved a lot. However, Chromatica still doesn't highlight some header names.
For example vector, system_error, cstring and unistd.h in this file are not highlighted.
Is this normal or do I need to do anything else?
I have tried adding every path from
echo | clang -std=c++17 -v -E -x c++ -
with -I in .chromatica but nothing changed.