-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Cache instances from call hierarchy provider #10857
Merged
Merged
Conversation
This file contains 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
colin-grant-work
force-pushed
the
bugfix/CH-ensure-same-item-instance
branch
from
March 16, 2022 23:58
1995457
to
5fb525f
Compare
…bugfix/CH-ensure-same-item-instance
…bugfix/CH-ensure-same-item-instance
vince-fugnitto
approved these changes
Apr 22, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed that it works well 👍
- the code looks good.
- confirmed that
call-hierarchy
from out custom view works well usingclangd
. - confirmed that
show call hierarchy
(plugin side) works well as well.
…bugfix/CH-ensure-same-item-instance
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
What it does
As part of #10310, it was found that Theia does not satisfy the expectations of VSCode CLangD (or any other language client based on
vscode-languageclient
) because we do not guarantee that the plugin will receive the same instances ofCallHierarchyItem
s that it creates when calls are made.This PR addresses that problem by caching call hierarchy items received from plugins and retrieving them when passing them back into the plugin.
In addition, it moves some way to addressing #10528, but with a twist. Since call hierarchy items are now being cached, there's need for a signal to clear the cache, and the return from
CallHierarchyAdapter.prepareCallHierarchy
is now aCallHierarchySession
that includes a disposable to dispose of the cache. That isn't part of the API available to plugins, so the VSCode references view never disposes of its sessions (as far as I can tell,CallHierarchySession
s are never disposed of in VSCode), but our internal view does know when to dispose of its sessions, so I have left the view in, but adjusted the types to eliminate our purely internal types in favor of close mirrors of the plugin types.How to test
examples/cpp-debug-workspace
from the Theia CPP Extensions repoa.cpp
Calls: Show Call Hierarchy
on one of the functions there other thanmain
.Review checklist
Reminder for reviewers