The usage of UTF-16 in LSP is, of course, comical, and makes it kind of hard to take the protocol seriously. It also requires every message to indicate which message it’s a response to (if any) which avoids the causality problems of LSP. Unfortunately the current maintainer of seems to not really be interested in the cross-language potential and just focuses on the reference implementation in Clojure, which makes it hard for potential users in other languages to see the benefits.Īnyway nREPL uses swappable transports and encoding, but the default encoding rather than JSON is bencode, which you can implement in an hour or two in a couple pages worth of code and is really fast. The nREPL protocol out of the box mostly defines operations which focus on running code rather than static analysis, but it includes some like jump-to-definition which aren’t, and it’s easily extensible to add new operations. The Dart one saw half the solution in that you need to build something in common for all editor clients, but missed the fact that you should also design your protocol to be agnostic on the server side too nREPL does this and could have functioned as the basis for LSP, but it didn’t have the branding power of Microsoft behind it, so it’s more or less a niche thing now. It’s interesting that they mention the Dart Analysis Protocol, because my first thought when I saw LSP was to compare it to nREPL, the language-agnostic extensible networked repl protocol originally developed by Clojure developers, but which has servers now available for a bunch of other languages too. I don’t understand why this model isn’t more widespread, because it’s great. ![]() The client sends a header indicating what encodings they support, the server finds the best one it can and falls back to JSON if nothing better is supported in common between the two. The answer seems painfully obvious to me HTTP has supported content negotiation for decades now, and LSP is based on HTTP but they just left this out. Of course, something substantially better than JSON is possible in theory. If you’re doing development on a slower target, it’s annoying because your fast laptop is now sitting idle while you run everything on (for example) a RPi. If you’re connecting to a big development server, that’s nice: they’ll now run on the fast machine. It then runs copies of your extensions on that instance. Arm Linux works now (though not older Arm, so no RPi1) but if you’re doing anything vaguely exotic like MIPS, RISC-V, or *BSD then good luck (if you’re using a non-glibc Linux distro, you will need to make sure glibc is available). ![]() This also means that it doesn’t work with any target that isn’t officially supported by MS: if you can’t run VS Code on it, you can’t connect to it with the remote extension. This immediately means that the thing that you’re connecting to must have the ability to make arbitrary outbound Internet connections and run arbitrary downloaded code from the Internet in the user’s home directory. Instead, the first thing that it does is pull a VS Code binary from a Microsoft server to the target. If you were designing something like this, you might imagine that it connects over SSH and then provides APIs to plugins that allow reading and writing files, running commands and connecting to those commands. I still find it astonishing that this wasn’t part of the first version of the spec, but I often have that reaction to VS Code things: they feel like they are driven entirely by time to market concerns, with solid engineering being a distant second (the way that the SSH remote connection support works is another good example of this). LSP servers can now opt into providing semantic styling information. I went and double checked the specification and it looks as if the support for doing this was added in the most recent release of the spec, so maybe there’s hope. ![]() You could build a hierarchy of things here, with type name as the fallback if you don’t know what a class name is (for example) and then consistently style code snippets in multiple languages. For example, I’d love to be able to have an HTML generator that took a source file (possibly some build instructions) and the LSP server to use and generated HTML with spans with a generic set of classes for things like keywords, class names, and so on. It’s even more annoying for things that want to use LSP servers in other contexts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |