[webkit-dev] How to set up Intellisense-ish code completion/suggestions for editing WebKit sources on macOS?

Philippe Normand philn at igalia.com
Thu Nov 11 13:55:26 PST 2021


Hi Mike,

About ccls, some of us Igalians use it on Linux, I compiled a few
tips&tricks:

https://trac.webkit.org/wiki/WebKitEmacsTips

Nowadays trunk includes a .ccls file, is it not working for you?

Alicia recently blogged about setting up clangd/VSCode, that's on Linux,
but maybe some parts apply for macOS too:

https://blogs.igalia.com/aboya/2021/10/02/setting-up-visualstudio-code-to-work-with-webkitgtk-using-clangd/

Philippe

On 2021-11-11 01:48, Michael[tm] Smith via webkit-dev wrote:
> Can anyone recommend a combination of text-editor/IDE, plugins/tooling
> (e.g., language server), and settings/config that’ll enable me to have
> usable code-(auto)completion/suggestions (like Intellisense, etc.) when
> editing WebKit sources in a macOS environment?
> 
> Specifically, I mean the particular type of code completion you get when
> you type the name of some instance of an object in your editor, and then
> a dot, and the editor then shows you a popup with the names of all the
> available member functions and data members you can use with that object.
> 
> Over the last several days, I have been trying (and failing) in multiple
> text editors to get working code completion like that set up for editing
> WebKit sources.
> 
> A big reason it doesn’t work with the WebKit sources is that all the text
> editors and tooling don’t seem to be able to find the header files
> referenced in the various .cpp sources — beginning with #include "config.h",
> but others as well.
> 
> I’m a diehard vim user, so I started out trying the available vim plugins
> that integrate with clangd. And the big problem I ran into there was that
> clangd relies on having a compile_commands.json file to work from — which
> (as far as I understand) essentially can’t be generated from the WebKit
> sources when building the macOS port (I have gleaned that’s in part due
> to the fact it’s a Unified build, which confuses clangd).
> 
> So the next thing I tried was integrating with ccls. That seems to work to
> the point of ccls successfully generating an index of sources — but then
> when I open a file to edit, I immediately get an error about ccls not being
> able to resolve the #include “config.h” reference — and the multiple errors
> about macro references it can’t resolve.
> 
> ...And then, ultimately, no completion suggests when I put a dot after a
> particular object name I want to get the function and data-member
> suggestions for. (It seems to work for some objects, but not others.)
> 
> I like ccls though, and I think (hope) it may be that if I set up my .ccls
> file with the right options for helping it find the header files it needs,
> it may actually end up working. But my current .ccls isn’t doing that.
> 
> Anyway, the last thing I’ve been trying is Visual Studio Code. In that I
> tried with both the clangd extension and the ccls extension, but ended up
> having basically the same problems I have with the vim integrations.
> 
> So I switched back to trying the Microsoft-provided C/C++ Intellisense
> extension (cpptools), and found that seems to work better than the clangd
> or ccls extensions — at least so far as it seems to be able to at last
> partially resolve the header include references. But then it too seems to
> stumble on not being able to find some headers it needs.
> 
> For example, I think I’ve been able to make it figure out #include "config.h" —
> but then the next problem I hit is stuff like this:
> 
>   cannot open source file "JavaScriptCore/JSExportMacros.h"
> (dependency of "config.h")
> 
> ...And then anyway, again, ultimately, no completion suggests when I put a dot
> after a particular object name I want to get the function and data-member
> suggestions for. (It seems to work for some objects, but not others.)
> 
> So I’m hoping others here might have something working successfully in
> their environments that gives them proper completion suggestions on member-
> function names and data-member names.
> 
>   –Mike
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev


More information about the webkit-dev mailing list