-
Notifications
You must be signed in to change notification settings - Fork 185
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
Call hierarchy: highlight call location for incoming calls #2208
Conversation
It could in theory also be used for outgoing calls if the call locations should be focused there as well.
Sorry but I still didn't quite like it due to loosening of the types and mixing wrapper item and normal items. I've pushed an alternative fix that normalizes hierarchy items into a single |
This is not how it works. You lose information in the |
Ok. I will look a bit more tomorrow. I thought that nothing else from the response was accessed. And of course we can revert my commits if needed |
Pushed alternative version that always uses a wrapper element. |
Perhaps my changes make namings a bit inconsistent right now - element, data, item... |
To be honest, I don't really like some of the new names. And I would still use HirarchyItemWrapper as the name instead of HierarchyData. Besides that, I think it should work now and the other changes seem fine to me. |
I can't approve my own pull request, but it looks good to me now. |
Based on a suggestion from sublimelsp/LSP-typescript#186 (comment).
For the incoming calls ("callers of...") in the call hierarchy, if you click on an item, it will currently open the first line of the function definition. But with this change, it would highlight the (first) location of the actual call within the function instead.
I've also tested what VSCode does, and it seems that it randomly highlights either the call location, or the first line of the function. And it randomly changes even for the same item... probably they have a bug somewhere.
Recording from VSCode
vscode-call-hierarchy.webm
Anyhow, I think it is more useful doing it this way (up for discussion).
The implementation is unfortunately very ugly, but I don't see a different way other than storing the location into the
CallHierarchyItem
itself, because a CallHierarchyItem is not necessarily unique, and theget_tree_item
method to render an item has no other input. If someone sees a better way, any improvements are of course welcome.