← Back to context

Comment by jesse__

9 hours ago

> It's not network requests that are a problem. It's nondeterministic network requests.

Ohhhhh, right, my bad. I forgot that you could just make network requests deterministic with the __do_it_determinstically flag. Of courseeee, how could I be so silly.

..

Think about it; you just illustrated my point exactly. If the network request is assumed to always complete, with the desired payload,, and the client/server exist on the same machine, then why the fuck is there a network request?? An LSP server is just a library, but instead of being loaded into the process address space like a normal library, there's a separate server for some unknown reason.

Anyways, /rant

A local network connection is the lowest-common-denominator way to do foreign function calls. This allows the language server to be written in any language you like without having to deal with the complexity of linking code written in different languages together. It just starts another process and connects to it.

For example, VS Code is written in TypeScript and the Go language server is written in Go.

Do the client and server necessarily exist on the same machine? I thought vscode had an architecture where the frontend and backend could be on separate machines, although I don't know if the LSP crosses that gap.

Also, I'm sure there's a way to do it, but if someone wanted to write an LSP in Haskell and the editor was written in JavaScript, I'm not sure it would be as straightforward to load it as a dynamic library as you suggest it should be.

  • Theoretically, the client/server don't have to be on the same machine, but in practice they mostly are.

    As for the interface.. any language that can't speak the C ABI isn't a real language (read: they all can).. but this is besides the point.

    Counterpoint; when's the last time you used an editor written in JavaScript and an LSP written in Haskell? I bet never.

    • If you install the VSCode plugin for Haskell, I’m pretty sure that’s what you get?