haskell / lsp

Haskell library for the Microsoft Language Server Protocol
359 stars 89 forks source link

Rewrite progress handling to allow for debouncing messages #571

Closed michaelpj closed 1 month ago

michaelpj commented 2 months ago

This had to be redone in order to allow us to "wake up" and notice that there are pending messages. I also wrote it so there can be a stateful interface (the ProgressTracker) which I think might make it easier to use in that weird case in ghcide. I haven't exposed that yet, though.

michaelpj commented 2 months ago

@soulomoon what do you think? I think the ProgressTracker interface might be usable for that weird case in ghcide, since it lets you store it and call the update function from various places. The cost is that you have to deal with cancellation etc. yourself, but that seems maybe inevitable.

michaelpj commented 2 months ago

I also need to actually test this with a live HLS and see if I can actually notice the difference!

soulomoon commented 2 months ago

I also need to actually test this with a live HLS and see if I can actually notice the difference!

This piece of code in HLS is quite delicate, the previous version did not work well. Maybe you can pick up my branch and adapt it a bit to see if the new api works ? https://github.com/haskell/haskell-language-server/pull/4206

michaelpj commented 1 month ago

Turns out the stateful interface wasn't really that helpful and complicated things, I think https://github.com/haskell/haskell-language-server/pull/4218 is actually perfectly fine with the normal interface, arguably even clearer.