Git Product home page Git Product logo

Comments (8)

rwols avatar rwols commented on May 26, 2024

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.

from language-server-protocol.

michaelpj avatar michaelpj commented on May 26, 2024

So if we have the following sequence:

  • Client-initiated progress token
  • Server sends a begin report with cancellable: true
  • The user clicks the cancel button

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.

from language-server-protocol.

dbaeumer avatar dbaeumer commented on May 26, 2024

@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.

from language-server-protocol.

dbaeumer avatar dbaeumer commented on May 26, 2024

Added a clarifying sentence.

from language-server-protocol.

michaelpj avatar michaelpj commented on May 26, 2024

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?

from language-server-protocol.

dbaeumer avatar dbaeumer commented on May 26, 2024

That is more or less the sentence I added:

Canceling work done progress is done by simply canceling the corresponding request.

from language-server-protocol.

dbaeumer avatar dbaeumer commented on May 26, 2024

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.

from language-server-protocol.

michaelpj avatar michaelpj commented on May 26, 2024

Your sentence doesn't say

  • Clients can't cancel client-initiated progress with window/workDoneProgress/cancel. My text says they should not do that.
  • What the server should do if it receives a window/workDoneProgess/cancel notification for a client-initiated progress token. My text explicitly says that it should ignore it.

from language-server-protocol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.