‹ BackHN Continuity

Thread

Why building a Rust LSP is hard

144 points · 77 comments · agluszak

  1. mitxela · · focus · HN ↗
    Using a JSON TCP connection for what on Windows would be direct function calls (COM) or in Eclipse would be direct function calls between Java modules always felt a bit gross.
    1. bheadmaster · · focus · HN ↗
      In order to have direct function calls, you need to load the plugin's code in your own memory. Which means you expose your own memory to the plugin. Any malicious/buggy plugin could wreak havoc on your program - even managed code doesn't solve that problem in general.

      IPC is the natural solution to that - run a process in its own address space and communicate with it via I/O. TCP is not most optimal, but it is uniquous. Same thing with JSON.

      In LSP, most of the processing happens in the LSP server anyway - communication overhead between client and server is negligible in comparison to it.

      1. vips7L · · focus · HN ↗
        Java has had plugin isolation libraries for decades.
        1. bheadmaster · · focus · HN ↗
          Most of which run the code in a subprocess and use IPC.
          1. vips7L · · focus · HN ↗
            Not in my experience
            1. bheadmaster · · focus · HN ↗
              Care to provide a counter-example?
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.