Closed michaelpj closed 6 months ago
Because client-initiated progress is tied to client requests, it seems to me that the client cancels the request and anything associated with it, such as progress, with $/cancelRequest
.
Because server-initiated progress can start at any moment, not being tied to a request, clients need some way to cancel the background computation. Using window/workDoneProgress/cancel
in this case.
So if we have the following sequence:
begin
report with cancellable: true
Is the client supposed to cancel the action with $/cancel
? From the client perspective that seems more complicated, and I wouldn't be surprised if many of them just send a window/workDoneProgress/cancel
.
From the server side it's not any harder to support window/workDoneProgress/cancel
for all progress tokens, so I'll probably do that regardless. But it would be nice if the spec was clearer.
@rowls thanks for the great explanation.
@michaelpj the only sentence we could add is to say that client side progress is to be canceled using $/cancel
message since they are bound to a request in the first place.
window/workDoneProgress/cancel
is a server to client message only. So clients should never sent them to the server.
Added a clarifying sentence.
window/workDoneProgress/cancel is a server to client message only. So clients should never sent them to the server.
I think you mean the opposite? https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#window_workDoneProgress_cancel
I think the helpful sentence to add would be one to the section on window/workDoneProgress/cancel
, something like: "A client should not send a window/workDoneProgress/cancel
notification for a client-initiated progress token (instead it should use $/cancel
to cancel the associated request). If a server receives such a notification it should ignore it and should not cancel the request."
Is that right?
That is more or less the sentence I added:
Canceling work done progress is done by simply canceling the corresponding request.
And you are correct. The window/workDoneProgress/cancel
is a client to server message.
Client initiated progress is always bound to a request. It can't exist by itself.
Your sentence doesn't say
window/workDoneProgress/cancel
. My text says they should not do that.window/workDoneProgess/cancel
notification for a client-initiated progress token. My text explicitly says that it should ignore it.
The cancellation support via
window/workDoneProgress/cancel
is nice, but from the specification it seems like it's only available for server-initiated progress. It would be nice if they had feature parity, since otherwise it seems as though server-initiated progress is mostly just better?