MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.73k stars 255 forks source link

Getting ccls to work with the WebKit browser sources #843

Open sideshowbarker opened 2 years ago

sideshowbarker commented 2 years ago

I’d like to get ccls working with the WebKit browser sources from https://github.com/WebKit/WebKit.

I have a .ccls file set up but not yet adequately for handling the idiosyncrasies of the header includes in the WebKi sources.

I can get ccls to successfully generate an index from the WebKit sources. And I have ccls integration set up both in Vim (using coc.nvim configured with ccls as the language server) and in Visual Studio Code (using the ccls extension).

But when I then try to edit any of the WebKit sources from within Vim or VSCode — against the generated ccls index — I get errors about included header files being missing.

For example, the https://github.com/WebKit/WebKit/blob/master/Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp#L26 file has an #include "config.h" line that gets flagged with 'config.h' file not found [clang-diagnostic-error].

clang and other compilers can compile the WebKit sources, so the compilers at least are able to resolve those header includes. So I’d imagine that ccls could as well — if I could find out how to teach ccls to do whatever the compilers are doing.

philomates commented 2 years ago

https://trac.webkit.org/wiki/WebKitEmacsTips explains a bit at the bottom about a config.h headers issue, maybe that can help you get unstuck?

There is also some related material (for emacs) in https://blogs.igalia.com/vjaquez/2020/11/26/notes-on-using-emacs-lsp-ccls-for-webkit/

That said, I'm also in the process of setting up WebKit with ccls and neovim, so I'd also find step-by-step setup material helpful