Declarative extensions #28430
maxnordlund
started this conversation in
Extensions and Themes
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been using Zed as my main editor for a few months now and really appreciate all the thought that went in to the fundamentals behind the extensions (e.g. using WASM/WASI).
However I've noticed the official/well maintained ones supports downloading language servers1, while the less polished ones2 does not. So I read through their source and realized they look very boilerplatey. This makes me think that most of the current set of features can be done declaratively in the
extension.toml
.Let's take the Elixir extension as an example. It supports three different LSP's, but with varying level of support for their settings. Only Lexical seems to support custom startup arguments. But I digress, here's the extension manifest at the time of writing this:
extension.toml
The code for
next-ls
is in https://github.com/zed-extensions/elixir/blob/main/src/language_servers/next_ls.rsNow imagine we could specify that in TOML instead:
I'm sure I've glossed over some intricate detail that makes this less then straight forward. Some will still need the full power of being compiled, but I believe that most extensions could be reduced to being purely declarative. The extension code could either be generated on the fly, or some sort of generic implementation for declarative extensions only. The former would be backwards compatible, which is nice.
The real upside would be support for more features across the board. I'm mostly thinking of the customization of the sever command, arguments, and environment. But also customization of the initialization request sent in the very beginning (for example to enable/disable completion or inline formatting), and sending a "workspace configuration" request shortly after. These customization's vary wildly between different extensions, and even within one. Only one of the three language servers in the Elixir extension supports custom server arguments, and as far as I can see, none supports customization of the server environment.
Footnotes
Among other features, mostly regarding starting and configuring language servers. ↩
It doesn't have an LSP, but there's a PR for it. ↩
Beta Was this translation helpful? Give feedback.
All reactions