RFR: 8223678: Add Visual Studio Code workspace generation support (for native code)
Robin Westberg
robin.westberg at oracle.com
Fri May 31 12:27:31 UTC 2019
Hi Volker,
> On 29 May 2019, at 16:01, Volker Simonis <volker.simonis at gmail.com> wrote:
>
> On Wed, May 29, 2019 at 3:43 PM Robin Westberg
> <robin.westberg at oracle.com> wrote:
>>
>> Hi Volker,
>>
>>> On 28 May 2019, at 17:33, Volker Simonis <volker.simonis at gmail.com> wrote:
>>>
>>> Hi Robin,
>>>
>>> thanks a lot for doing this!
>>>
>>> I have just a quick question. Do you know if any of the VSC indexers
>>> (default, clangd) support call hierarchies (i.e. "called by",
>>> "callers" of a function/method) and "used by" for variables/class
>>> fields?
>>
>> Sure, I can make a quick summary of the various pros and cons of the indexers that I’ve found so far. They are all moving pretty fast though, so didn’t think it was a good fit for the documentation file.
>>
>> In general, VS Code itself only just recently gained proper support for displaying call hierarchies: https://urldefense.proofpoint.com/v2/url?u=https-3A__code.visualstudio.com_updates_v1-5F33-23-5Fcall-2Dhierarchy&d=DwIFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=UJlIwvo0Thp_BYS_NWFT0ryBTIkcL2KhsFz8CKsa4GY&m=82pYT4_vb0KoCg2J7f8ZHebXioM2IbSDUpVgSuUAz-A&s=yY4u7WPyw8IMAQOytIDpU3MePzQMuGgCTyIP4XuHXbI&e= - but alternative indexers have worked around this by showing them differently.
>>
>> Default (Microsoft - C/C++ for Visual Studio Code)
>> + Easy to setup, as no additional dependencies are needed
>> + Good “go to definition”, the only one that can make sense of the template+macro stuff in log.hpp for example
>> - Find references (used by) not done yet (said to be coming in the June update: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_microsoft_vscode-2Dcpptools_issues_15&d=DwIFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=UJlIwvo0Thp_BYS_NWFT0ryBTIkcL2KhsFz8CKsa4GY&m=82pYT4_vb0KoCg2J7f8ZHebXioM2IbSDUpVgSuUAz-A&s=usQi8Sluzbg7sm51fLwBgFVSkY8uj_ZkOgFhT6clIjw&e=)
>> - Call hierarchies also not there (scheduled for September apparently: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_microsoft_vscode-2Dcpptools_issues_16&d=DwIFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=UJlIwvo0Thp_BYS_NWFT0ryBTIkcL2KhsFz8CKsa4GY&m=82pYT4_vb0KoCg2J7f8ZHebXioM2IbSDUpVgSuUAz-A&s=0nJoexh1jJuqrNQ5bhxtpwdzS9LhGYhzKyEmFbM1D8A&e=)
>>
>> clangd
>> + Actively developed and part of the llvm/clang project
>> + Support for find references
>> - ..but not call hierarchies yet
>> - Full project indexing is still flagged as experimental, and currently seems to fail when editing commonly used header files for example
>>
>> Full feature list: https://urldefense.proofpoint.com/v2/url?u=https-3A__clang.llvm.org_extra_clangd_Features.html-23complete-2Dlist-2Dof-2Dfeatures&d=DwIFaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=UJlIwvo0Thp_BYS_NWFT0ryBTIkcL2KhsFz8CKsa4GY&m=82pYT4_vb0KoCg2J7f8ZHebXioM2IbSDUpVgSuUAz-A&s=-59_vkfX4TV8qO7PoHopjLBC1c2Qu-HjneQnNM49Zps&e=
>>
>> rtags
>> This is currently the most feature-complete indexer I think. But the VS Code integration is a bit minimal and not part of the rtags project itself, and it is missing things like indexer progress.
>> + The indexer is actively developed and has been around for quite some time
>> - You will probably have to build the indexer from source
>> + Full support for call hierarchies and find references
>> - VS Code integration a bit limited, missing convenience features like switch between header/source file, showing method/class documentation on hover.
>>
>> There are even more indexers of course, a promising one used to be “cquery", but that project seems to be defunct now. It lives on in the “ccls" indexer, but ithat one is a bit tricky to configure unless you use clang for building the JDK as well.
>>
>> So in summary, after the summer the default indexer might be the obvious best choice, but right now it depends on which features you think are the most important I guess..
>>
>
> Hi Robin,
>
> thanks a lot for the great summary! Incidentally I've just did some
> Google research as well and basically came to the same conclusion.
> "Cquery" seemed quite promising and also pretends to have call
> hierarchies. But it seems to be defunct and I've also found some bug
> reports about problems with the call hierarchies.
Yeah, cquery did work okay when I tried it, but had some issues. However, the “spiritual” successor ccls has fixed all the issues I had with cquery, I spent a bit more time on configuring it today and finally figured out why it didn’t work!
> For me "Called Hierarchy", and "Find References" (in this order) are
> really the most important IDE features. I'm using Eclipse and if you
> setup your HotSpot project correctly, these features work pretty well
> and reliably.
>
> Have you personally tried the rtags "call hierarchies" / "find
> references" support in VSC? From your summary it sounds like it's
> worth giving it a try.
Only tried it a bit, but I know other HotSpot developers that use it with emacs / vim. But the VS Code integration is really bare-bones, so a bit hard to use it in practice.
But now that ccls actually works, I can really recommend you try that one, working very good for me so far!
> Thanks again for caring about these topics! Hotspot development with
> IDE support has always been a pain and every improvement in this area
> will be highly welcome :)
Sure, I mostly do it since I want to be able to use a good IDE myself, but it’s always nice if others can benefit from it too. :)
Best regards,
Robin
>
> Best regards,
> Volker
>
>> Best regards,
>> Robin
>>
>>>
>>> Regards,
>>> Volker
>>>
>>> On Mon, May 27, 2019 at 6:03 PM Robin Westberg
>>> <robin.westberg at oracle.com> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> Please review this change that adds build system support for generating a Visual Studio Code workspace configured for working with the JDK native code. It configures the default C/C++ IntelliSense Engine to allow code completion/navigation and similar features. It also configures two executable targets (gtestLauncher and java) that can be built and debugged from the IDE.
>>>>
>>>> The main target is "make vscode-project”, additional information can be found in doc/ide.[md|html].
>>>>
>>>> Issue:
>>>> https://bugs.openjdk.java.net/browse/JDK-8223678
>>>>
>>>> Webrev:
>>>> https://cr.openjdk.java.net/~rwestberg/8223678/webrev.01/
>>>>
>>>> Testing:
>>>> Manual testing on Linux, MacOS and Windows
>>>>
>>>> Thanks Erik Joelsson for taking a look at an earlier version of it!
>>>>
>>>> Best regards,
>>>> Robin
More information about the build-dev
mailing list