haskell/haskell-language-server

making hls ready for talking to multiple clients

MangoIV opened this issue · 1 comments

Hi everyone. Upon popular request (looks frightened at @fendor) I will hereby create a small tracking issue for making HLS ready for multiple clients. Here are the things that need to be done:

  • make HLS accept URIs that are not file URIs. This is currently being implemented in #4622
  • fix some concurrency issues that only come up when you connect multiple clients #4663
  • semantic tokens for the entire AST so a client can get syntax highlighting without the client supporting anything but lsp #4672
  • perhaps the most controversial one; integrate a websocket server. This is actually the first "actual" implementation of the proposed feature. The proposed changes are tracked in #4666. Of course, the websocket communication would be factored out to a separate module but the general idea is to abstract the "communication" away and then allow the main entry point to also spawn multiple instances of the server and talk to them via newly passed "communications"

While they're not finished (except for task 2 which only needs merging), the above three things are working in the sense that HLS talks to multiple clients via websockets in parallel.

Open problems:

  • the main problem is sandboxing:
    1. How do we isolate GHC sessions (actually something that I would like to ask someone with more knowledge, perhaps @wz1000?)
    2. How do we make sure people don't make HLS go crazy with template haskell/ System.Process etc etc (something to figure out in the actual sandbox)
    3. How to add a feature of limiting new connections to HLS based on current memory usage (problematic because it's not exactly HLS' task to do this in theory but in practice it's really the only place to do it)
  • how do we split up communication so that HLS doesn't do things it shouldn't do (@fendor really doesn't want to see a dependency on websocket)

The related issue to integrate HLS into haskell playground can be found here:
haskell/play-haskell#57

A prototypical implementation for a web client for hls based on monaco can be found here:
https://github.com/MangoIV/hls-playground