haskell / lsp

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

Add a generic progress start and update delay #549

Closed michaelpj closed 3 months ago

michaelpj commented 8 months ago

At the moment we send progress start messages as soon as we can, and updates whenever we get them.

This means that:

We could potentially handle this generically: only send progress messages after a fixed interval has passed (should be configurable). In particular, if the operation terminates before we hit the first interval, we could send nothing.

This would let people declare most handlers to support progress and automatically get nice behaviour where progress is shown only if it takes a noticeable amount of time.

michaelpj commented 8 months ago

This should let us get rid of a decent chunk of https://github.com/haskell/haskell-language-server/blob/b91c9076367123e983087ed305d183288a23f494/ghcide/src/Development/IDE/Core/ProgressReporting.hs#L108

michaelpj commented 5 months ago

Okay, I'm going to work on this for a little.

soulomoon commented 5 months ago

Sounds good

michaelpj commented 5 months ago

This is slightly annoying with the way it's currently done. In particular, at the moment we only do things when we get an update from the updater function, but once there are delays in the picture we probably need to wake up and send the last update that we saw every now and again, otherwise we might get quite bad behaviour. Which I think necessitates another thread handling that. So I need to refactor a bit.

michaelpj commented 3 months ago

I did this