`requestHandler` receives the continuation - is there a situation where that's necessary?
To my understanding, for any request, the server is to invoke the continuation that produces the response exactly once - so why does lsp not do that by itself? It seems unnecessary to give the user the freedom to drop the continuation or even invoke it multiple times.
I guess one could indeed come up with an example where you want to put the continuation in a work queue or something like that but I expect that lsp itself should have better insight on when to actually invoke the continuation than any user of the library? Or you could just provide a hook where all IO actions that fire a response go through?
See https://github.com/haskell/lsp/issues/405 and https://github.com/haskell/lsp/issues/409.
The basic issue is that lsp does not handle requests concurrently at the moment (which is crazy). So if you send a request in a request handler and block waiting for the response, you will block the original request handler and the whole server will get stuck.
Really the whole thing needs a rewrite IMO.
that's interesting! Yes I agree that this would probably need to be changed. What are the blocker for handling the requests concurrently? I'm guessing there's some oddities in the lsp spec that would making it concurrent by default buggy (if not carefully implemented)?
No, there's nothing in the spec that makes it problematic. It's mostly just a question of library design.