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

Michael[tm] Smith mike at w3.org
Wed Nov 10 17:48:47 PST 2021


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

-- 
Michael[tm] Smith https://people.w3.org/mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20211111/e2cb46a7/attachment.bin>


More information about the webkit-dev mailing list