microsoft / language-server-protocol

Defines a common protocol for language servers.
https://microsoft.github.io/language-server-protocol/
Creative Commons Attribution 4.0 International
11.16k stars 785 forks source link

Whose responsibility is it to timeout long-running operations? #1916

Open michaelpj opened 5 months ago

michaelpj commented 5 months ago

Many operations can take a long time in some situations. As a real example, some of the HLS formatting options relied on getting the build options for the project, which required setting some things up, which can take a little while. This means that if e.g. a user has format-on-save set up, then they will get blocked on save until the setup is complete.

Now, in this situation it seems clear that the formatting should just get timed out quickly. The question is whose responsibility that is:

My instinct is to say that it's the client's responsibility. In particular, in this example the acceptable time for a request to take is probably different for user-initiated formatting vs format-on-save, but this distinction is not visible to the server. So this aspect of UX responsiveness is probably in the client's court. But I thought it was interesting to talk about!