Idea: client API
Langoustine provides an easy way to build servers, but AFAIK there's no such thing for clients. If you were to implement a language client with Langoustine, what could that look like?
Potential usecases:
- e2e testing of LSP servers
- web UI/CLI/TUI LSP client
- ???
I'm thinking something along the lines of:
def client[F[_]](endpoints: LSPBuilder[F] => LSPBuilder[F]): Resource[F, Communicate[F]]
That's be at a similar level of abstraction to LangoustineApp. Notably you need a builder because the client still needs to handle some requests/notifications from the server, and these can also talk back to the server via the Communicate passed to each endpoint. At the very end you're left with a Communicate which you can use to call the server at the top level, e.g. with an initialize request or whatever else you wish.
At the moment you can already construct a Communicate from a Channel, so I think the only remaining part is providing the wiring for the users. Maybe even in the same module as app, or - even as LangoustineApp.client.
I'd love to have a client abstraction – at the very least for E2E testing, or for the optional module that allows testing your LSP server directly by launching a mini-embedded LSP client in there with a codemirror editor – or whatever modern web editor has a non-buggy LSP implementation.
def client[F[_]](endpoints: LSPBuilder[F] => LSPBuilder[F]): Resource[F, Communicate[F]]
Something along those lines, yes, but I think we'd need to introduce a narrowed LSPBuilder type (LSPClientBuilder may be) which takes LSPRequest alongside some marker trait for requests/notifications that a LSP client is expected to respond to