-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Fixes for work done progress #253
Fixes for work done progress #253
Conversation
To prevent confusion, this is about cancellation, but a completely different one from the |
860c5af
to
db66295
Compare
It looks really good to me. Though I'm not very familiar with the area. Do you think it warrants anding to the changelog? Anyway, from my perspective I'm happy to merge it. Would you like someone with more experience of the area to review as well? |
Thanks @tombh
yes, we should probably add a line in Added section, with something like that: Support cancel notification for work done progress tokens
I believe the part that is most important to discuss is the added API, the Lines 77 to 87 in db66295
This adds two methods for more or less the same thing ... that does not smell so good. The LSP architecture made it easy to have a on_cancel callback, but having a is_cancelled sync method seemed to be often easier to use (as we can see in the json example).
Another idea I just have is that we could expose a I'm going to make this amendment and add a changelog entry first (not sure I will have the time to do this before going on vacation) |
Ok, sounds good. |
343cf98
to
1e3e134
Compare
@tombh thanks, I changed API to expose futures directly, as discussed. While doing this I realised that |
@perrinjerome The API looks great. Thanks for working on this. |
Just a friendly ping to see where we are with this? |
Instead of using a constant, pass the token to assert it is correctly propagated
1e3e134
to
9e7f7ce
Compare
This looks good to merge then! Just the Pyodide tests failing for unknown reason 🤔 Even though I see you've ignored set the new tests to ignore Pyodide, hmm. |
This allows servers to be notifiied when client cancelled the progress and stop computation. The old cancel method is removed, because it was not corresponding to anything from the spec. Note that the tests have to be skipped on pyodide, as they now use asyncio.sleep
this test was only covering client iniated progress
9e7f7ce
to
557a5cd
Compare
Hi @tombh thanks for the reminder, for me everything was "good enough to merge" at the time, but there was this discussion above regarding the XXX comment. Today I rebased and I have pushed the new commits in this branch and I believe this is OK. The rebase was straightforward, the conflicts were mostly with imports being changed and slightly different names. Also, what was problematic with the previous version of this pull request has been solved by lsprotocol and pygls 1.0:
|
That's great, thank you. |
Thanks ! About the failed pyiodide tests everything looks OK on CI, so in my understanding everything is OK now. I used to have an old appveyor connected to my repository and this was failing, so maybe that was the problem. I removed it and now it's green. In any case, if these changes cause issues, let me know and I'll take a look. |
Sure, no problem. |
Description (e.g. "Related to ...", etc.)
Work done progress ( relevant specifications for reference ) had a few problems. It was possible for server to create a cancellable progress, but cancellation message were not handled by pygls framework. There was an implementation of
cancel
, but it was incorrect, as pointed out in #233 , it was implemented as if cancel was initiated by server, but cancel actually initiated by client.This removes the old
cancel
method and changes thetokens
mapping of progress instance so that it holds future corresponding for each tokens. The future are cancelled when a work done progress cancellation notification is received. This way, server code can either check thecancelled
method of the future, as it is done in the json example:pygls/examples/json-extension/server/server.py
Lines 208 to 211 in 130f52a
The example json extension has been updated, these changes can be tested by:
start the progress
commandcancel_progress.mov
This also contain some related fixes - that I can submit separately if you think it's better:
WorkDoneProgressOptions.workDoneProgress
type was incorrect (I don't know how to test, vscode does not support this at this time)Everything should be detailed in individual commit messages.
Fixes #233
Code review checklist (for code reviewer to complete)