Correctly report completed progress for subsequent MethodWrapper calls. #2827
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.
How to reproduce
doSomething
method declaration (at the bottom) and it will produce 2 child elements under themain
node.doSomething
elements causes the computation to occur and progress is reporteddoSomething
element simply uses the cachedMethodWrapper
, which won't report progress.The result (eg. in VS Code) is that progress-based UI elements can spin forever.
I think this highlights a general class of issues we're going to have between JDT-LS and JDT/Eclipse API. When we pass in a progress monitor to some API, we expect it to always report progress end. Sometimes this doesn't happen.
When I fixed #1722 the main issue was to stop us from incorrectly reporting (eg. 1000% complete). However I introduced an inaccuracy. Specifically : https://github.com/eclipse-jdt/eclipse.jdt.ui/blob/055a935ec3f04c17f5b1ba6a2a8c95380ca5226c/org.eclipse.jdt.core.manipulation/core%20extension/org/eclipse/jdt/internal/corext/callhierarchy/MethodWrapper.java#L86-L100
So if
fElements
(the returned method calls) are cached from a previous call, then we don't report progress.Note that expanding/collapsing a given element also shouldn't trigger this because the client-side UI already has the data. There needs to be 2 instances of the same element in an incoming/outgoing call.