Feature request: Call Hierarchy
svenefftinge opened this issue ยท 25 comments
A call hierarchy of a function invocation is a very useful tool to quickly navigate in code. In VSCode I find my self using "Find Reference" repeatedly to do what I do with a call hierarchy in IDEs (Eclipse, IntelliJ).
UI-wise I think it could fit nicely with how "Find References" is done, but of course we would need to have a tree on the right hand side and the labels need to display the reference containing function definitions.
Conceptually it is close to a type hierarchy, which is requested in #15533.
Adding my vote to this one. This would be my number 1 most important missing feature and use it daily in eclipse to navigate and understand the structure of a large code base. I can live without find all references feature and use global text search with whole word option instead.
This feature is really necessary for people like me who need to browse source code of multiple open source projects.
It would be super beneficial especially for users coming from eclipse,intellij background.
@hualet @sandipanbiswas FYI we ignore comments in the sprit of "+1", "me too", "This is needed" etc but go for up votes (:+1:) on the descriptions of this item. Please refrain from adding these comments because it generates a lot of noise to the project and we spend time reading these comments instead of getting actual coding work done. Thanks
anynews
For those in interested in this, I think we can stop asking for news on this for a while as I found this comment from 2018-08-06:
microsoft/vscode-cpptools#16 (comment)
No news. We haven't started working on this yet. We plan to implement IntelliSense-based Go to Definition and Find All References before a Call Hierarchy, all of which requires implementing a multi-translation unit IntelliSense (our currently one is only one translation unit at a time).
EDIT: as per @svenefftinge's reply, the above comment might only be related to the c/c++ extension.
@thernstig I think that comment is related to the c/c++ extension not generally to VS Code.
I need it desperately now - call graph or call hierarchy!
I agree, this is desperately needed
There now is a PR for this for the LSP
microsoft/vscode-languageserver-node#420
this feature will make our life easier.
I will explore this during the March milestone. Stay tuned.
UI-wise I think it could fit nicely with how "Find References" is done, but of course we would need to have a tree on the right hand side and the labels need to display the reference containing function definitions.
@svenefftinge The common UX for this seems to be a tree with a details pane on the side. Eclipse and IntelliJ are very similar, VS used to be a little different wrt calls/callers, e.g instead of the global direction toggle there could be nodes like 'Calls from "Foo"' and 'Calls to "Foo"'. That adds one more indent level for each symbol but it allows to see calls and callers at the same time. Something the Eclipse UI doesn't do:
Comments, ideas, preferences? Embedding this information as peek and/or viewlet should be doable. I was also thinking about a breadcrumb'ish approach, similar to the columns view of the Mac Finder, where a column represents all calls of a function and where expanding a call adds a new column.
@jrieken My preference would be for the Eclipse style of call hierarchy over the VS style. The later, whilst more functional, I feel will get very noisy quickly; and in this situation I feel "less is more".
I Eclipse I am able to 'pin' a given call hierarchy such that I can have a few open at once, for me this deals with the uni-directional nature of the hierarchy.
My preference would be for the Eclipse style of call hierarchy over the VS style. The later, whilst more functional, I feel will get very noisy quickly; and in this situation I feel "less is more".
I was thinking along those lines but allowing all, e.g. "show calls", "show callers", "show call & callers" (vs style). Think of the radio buttons in the Eclipse UI but in a way that both can be selected at the same time.
I was also thinking about a breadcrumb'ish approach, similar to the columns view of the Mac Finder, where a column represents all calls of a function and where expanding a call adds a new column.
Green Hills, an embedded systems compiler and IDE, implemented call hierarchy this way. In theory it sounds good, but in practice it ends up being kinda clunky because it requires so much screen real estate, as it expands in both the X and Y directions, that it needed a separate window to navigate it. I much prefer Eclipse's implementation in this regard, as it can be displayed simultaneously to the side of the code window, since it really only expands in the Y direction as call depth is increased, and you can scroll vertically to the area of interest.
See this screen shot from the Green Hills IDE, illustrating this, (the blurred parts are from scrubbing the proprietary info)
New UX proposal that stays closes to reference search peek. Have a tree on the right, have an editor on the left. The tree shows containers, e.g. functions calling the anchor function, with a hint of how often a function calls the anchor function. The editor itself highlight them.
This is our current favourite and this is what we will invest more in. The same/similar UI must be thought of when having the call hierarchy in the bottom panel
This is awesome.
Finally some hope for call hierarchy. Thank you all.
@zdog234 - Is this available for golang in vscode, i'm on the latest release and i'm unable to find this feature
@gandhiprachi I don't believe it's been implemented yet:
microsoft/python-language-server#888