Visual Studio Code Call Hierarchy

Viewed 3301

I recently saw a video that showed a nice call hierarchy feature available for VS Code (https://www.youtube.com/watch?v=r5LA7ivUb2c). However, when trying this in my own VS Code editor by right clicking on a function, the "Show Call Hierarchy" option is not visible.

I have the latest version of VS Code installed so am quite surprised that this feature is not available. Since I mainly code in C++ (and sometimes C), and use Linux (Ubuntu) as my OS, could these be possible reasons why the call hierarchy feature is not available for my editor?

1 Answers

As of today, vscode-cpptools does not support this: see this issue. As you can see, we are not the only ones desperately needing that feature.

As suggested there, you can try and install vscode-clangd (make sure to disable the C/C++ extension, it should prompt to do that once installed anyways). Once you have configured it via compile_commands.json, you get pretty much everything out of the box, including call hierarchy. This has still some limitations, see this issue, that, unfortunately, is out of the developers' control.

Bottom line: if you can live with this, use vscode-clangd and let's pray someone will hear our suggestions, or consider using another IDE, for instance Visual Studio.

For those interested in cross-compilatation with C++, here is a question I asked a few days ago. To this day, still unanswered and uncommented, but might worth checking out every once in a while.

That being said, I think it is pretty sad that in 2022 it is so difficult to find an IDE worth the name for C/C++.

Related