-
Notifications
You must be signed in to change notification settings - Fork 400
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
Investigate cancelling delegate commands #2415
Comments
Cancelling relies on the client sending the correct protocol given some event. For example :
It's basically up to the client to determine what causes cancellation and I see that the delegate command does have a reference to a progress monitor that was probably created from the cancel checker. Do we have an instance of some UI element in a client that correctly calls a long running delegate command that fails to respond to the cancellation ? If so we could definitely investigate that first. |
It looks like functionality to support cancelling delegate commands exists. If you take a look at https://github.com/redhat-developer/vscode-java/blob/master/src/extension.ts#L270 you can see that it tries to read the last parameter as the cancellation token. In order to cancel, all we need to do is send a cancellation notification to jdt.ls that contains the cancellation token. I'll take a look to see if a command already exists for that, if not, it shouldn't be hard to implement. |
If you insert a breakpoint at : and Now just trigger type hierarchy on some element. Allow the client side to continue, and once the breakpoint is hit on the language server side, activate type hierarchy on a different element. This should trigger the breakpoint on the client side again. Step over it, so the
Update: It works just fine for type hierarchy. My mistake from above is that I shouldn't have inserted a breakpoint to step over the cancellation on the client side. I suspect it was affecting the cancellation request being sent off, as I wasn't even seeing that. Letting the client side run while triggering the type hierarchy re-calculation had the LS monitor from the previous request switch to |
Try it with the gradle version upgrade feature (i.e. you have a very old gradle wrapper set, and there is a popup to update the version used). I was able to get cancelling to work for that case:
|
Ok, so then as part of this change, I think we just need to look at delegate commands that could run for a longer time, and ensure we check for cancellation. As a bonus, we could look on the vscode-java side to see if the UI supports cancelling some of these. This could be a relatively simple change to implement now that you've confirmed it should work. |
I can submit a PR for the gradle wrapper update, but maybe someone else in the future could investigate handling other cases? I'd be happy to answer any questions about it. |
Check if the request to upgrade gradle is cancelled, right before making any changes to the gradle build files. See eclipse-jdtls#2415 Signed-off-by: David Thompson <davthomp@redhat.com>
Check if the request to upgrade gradle is cancelled, right before making any changes to the gradle build files. See #2415 Signed-off-by: David Thompson <davthomp@redhat.com>
Working on this issue |
I think we can close this. As long as we check whether a given delegate command could reasonably be expected to receive cancellation from the client, we should provide |
For extensions on to jdt.ls, such as lsp4mp, it would be nice to be able to cancel DelegateCommands. The use case for lsp4mp is cancelling the workspace symbol calculation, which lsp4mp does using JDT through a delegate command. The language server that calls the JDT command can receive the cancel request from the client, but it can't tell JDT to stop the calculation.
The text was updated successfully, but these errors were encountered: