haskell / lsp

Haskell library for the Microsoft Language Server Protocol
364 stars 91 forks source link

Various fixes to progress handling #539

Closed michaelpj closed 9 months ago

michaelpj commented 9 months ago
  1. Server-initiated progress should wait for the client to acknowledge

This is an old bug. Per the spec, we're not allowed to send any reports using the token if the client doesn't respond with a non-error response to our creation of the token.

This is a bit subtle, because it means we may need to delay the sending of the "begin" notification until we have received the token from the client.

  1. No easy way to use client-initiated progress

This is simpler and faster than server-initiated progress since you don't need the extra message round-trip. You just need to pull out the progress token (if there is one) from the request and use that.

I did two things to make this better:

michaelpj commented 9 months ago

I'm actually unsure if we want to encourage people to use client-initiated progress, since I'm unsure if it allows cancelling properly: https://github.com/microsoft/language-server-protocol/issues/1873

michaelpj commented 9 months ago

Okay, I'm going to make it off by default since it's not clear how this will all work.

michaelpj commented 9 months ago

I added some more tests that actually exercise a bunch of the cases, so we can be a bit more confident that this works, hopefully.