-
Notifications
You must be signed in to change notification settings - Fork 323
Add call hierarchy feature #612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@bwilkerson I guess this would need support from the analyzer? I can't see anything in the docs that looks like it would provide this. @xster If we had the data, I'm not sure how we could best display this. We have implemented Type Heirarchy ( |
By call hierarchy, do you mean a tree where the top-level nodes are all of the methods containing invocations of a selected method, and the children of each node are the methods containing invocations of the parent node? If so, then it's all done lazily. Each level in the tree is fetched (by searching for references to an element) when the parent node is expanded. It is done this way both for performance and in order to deal with recursive chains of functions. The result isn't strictly a call hierarchy, it's a reference hierarchy, but the distinction is subtle and not interesting to most users. |
Aha, makes sense! I guess we can't wedge it into a picker like we did for types then; it'd have to go in the explorer (tree). |
I wonder if it's possible to augment the |
We can't really control this, since Code does all rendering here. However, I think you can do another Find References inside the peek window? |
This makes most sense implemented in VS Code - there's an issue at microsoft/vscode#16110. |
VS Code is adding new APIs for first-class support for this, so this might be possible soon :-) |
I noticed that in the new release notes too. Woohoo! |
I was just having a go at implementing this:
The API in VS Code can call us asking for the "incoming calls" and "outgoing calls" for a node (so you can navigate both ways). I think the incoming calls we could get with If there's nothing already there, then we could just build this in LSP on the server (rather than add new APIs that we'll migrate away from) once the LSP spec work for this lands. |
Any update on this one. |
I have an implementation of this working now. It's not a feature I've really used much myself so I am interested additional testing/feedback once it lands. It's implemented in the Dart SDK (LSP server), so you'd need to use a dev SDK in order for it to show up. One odd thing I've noticed though is that although we supply the ranges of outbound calls to the client, VS Code doesn't seem to use them. When you click a called method in the tree, VS Code jumps to the declaration and never seems to show you the locations of the outbound calls. There's an open issue about this at microsoft/vscode#111454 which may need 👍 's if that's to be addressed :-) |
@bsutton v2.180.271.0.dev looks like a branch made for a beta build (see flutter/flutter#107564) and forked before the change above. When using a newer version that does include the change, Call Hierarchy will appear on the context menu: |
@DanTup none of which show the menu. |
According to the tags shown on the commit, the following versions include it:
I don't know whether those 2.18 dev versions are just automatic tags though. Based on the issue linked above about branching for a beta release (which was before any of those branches), I suspect this change would not show up if that beta branch became a stable 2.18 release, instead being included in a future version. Note: Right now it seems dart.dev also stops at 2.18.0-271.0.dev which may be because of branching. If you want to test with a bleeding-edge build (not recommended for general production work) there's info here: https://dart.dev/get-dart/archive#main-channel-url-scheme For example for macOS: https://storage.googleapis.com/dart-archive/channels/be/raw/latest/sdk/dartsdk-macos-x64-release.zip for Intel or https://storage.googleapis.com/dart-archive/channels/be/raw/latest/sdk/dartsdk-macos-arm64-release.zip for M1. |
I'm using dswitch to move between dart versions and it only supports the
archive channels so this might have to wait until an archive gets released
with support.
S. Brett Sutton
Noojee Contact Solutions
03 8320 8100
…On Mon, 18 Jul 2022 at 22:53, Danny Tuppeny ***@***.***> wrote:
According to the tags shown on the commit
<dart-lang/sdk@f34d4d5>,
the following versions include it:
- 2.19.0-5.0.dev
- 2.19.0-4.0.dev
- 2.19.0-3.0.dev
- 2.19.0-2.0.dev
- 2.19.0-1.0.dev
- 2.19.0-0.0.dev
- 2.18.0-286.0.dev
- 2.18.0-285.0.dev
- 2.18.0-284.0.dev
I don't know whether those 2.18 dev versions are just automatic tags
though. Based on the issue linked above about branching for a beta release
(which was before any of those branches), I suspect this change would not
show up if that beta branch became a stable 2.18 release, instead being
included in a future version.
Note: Right now it seems dart.dev also stops at 2.18.0-271.0.dev which
may be because of branching. If you want to test with a bleeding-edge build
(not recommended for general production work) there's info here:
https://dart.dev/get-dart/archive#main-channel-url-scheme
For example for macOS:
https://storage.googleapis.com/dart-archive/channels/be/raw/latest/sdk/dartsdk-macos-x64-release.zip
for Intel or
https://storage.googleapis.com/dart-archive/channels/be/raw/latest/sdk/dartsdk-macos-arm64-release.zip
for M1.
—
Reply to this email directly, view it on GitHub
<#612 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG32ODEY6T4AX56S3QSJQDVUVHVNANCNFSM4ESAWSJQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm not sure what "archive channels" means in this context, but FWIW the latest Dart beta on https://dart.dev/get-dart/archive is 2.19.0-255.2.beta which should definitely include it. So if you're able to use beta releases (and not only stable releases) then it should be available. |
Don't know if it's possible. It's possible to check a function's call hierarchy in IntelliJ. Is it possible to bring it to VSCode?
The text was updated successfully, but these errors were encountered: