Introduce separate tree item types in the methods usage panel#2976
Merged
Introduce separate tree item types in the methods usage panel#2976
Conversation
This creates new tree item types for methods and usages such that these can contain references to their parent and children. This allows us to easily find the parent of a usage and to find the children of a method. This removes an expensive `find` call in `getParent`.
3 tasks
robertbrignull
approved these changes
Oct 16, 2023
Contributor
robertbrignull
left a comment
There was a problem hiding this comment.
Works for me when tested, and the code looks good. I think this is a good approach and very similar to what I tried to implement previously.
I also think renaming resolveCanonicalUsage to resolveUsageTreeViewItem is a good change. Unfortunately we can't remove this method unless the internal tree view data/type is the exact same as the data outside of the tree view, and that won't be the case now. We still do an expensive lookup in this method but I think this is an ok tradeoff and we call this a lot less frequently than we call getParent. It's also something we can look at improving again in the future if it's an issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This creates new tree item types for methods and usages such that these can contain references to their parent and children. This allows us to easily find the parent of a usage and to find the children of a method. This removes an expensive
findcall ingetParent.Checklist
ready-for-doc-reviewlabel there.