-
This is a discussion for the future plugin system, created in order to prevent further clutter of #122. Latest update: #3806 (comment)
The plugin system is being worked on at #8675. The language will remain scheme, but the implementation will make it possible to easily swap languages if for example we choose to implement our own scheme. If we decide to stick with Steel, it can also load cdylibs (see https://github.com/mattwparas/helix-config/blob/master/term.scm as an example).
|
Beta Was this translation helpful? Give feedback.
Replies: 64 comments 252 replies
-
what is the current status? it is hard to follow the issue. is wasm still on the table? i think it was a great idea. if not what other alternatives are taken into account? |
Beta Was this translation helpful? Give feedback.
-
Proposing a candidate for a plugin system: rhai. |
Beta Was this translation helpful? Give feedback.
-
Would Javascript be an option? Active development and its probably rather easy to expose an API. |
Beta Was this translation helpful? Give feedback.
-
@kirawi Can we start a curated list of plugin ideas right away. It might seem too early but if we have a list right now then it might be useful for future devs to take suggestions from. We could ask users to suggest neovim/emacs plugins they would like to see in helix and after a huge list gets created, we could put it in a poll where the devs can get a clear idea of what plugins or plugin ideas are necessary. |
Beta Was this translation helpful? Give feedback.
-
Hi, Just as a quick preface to understand where I am coming from: to me, the most important benefit of a plugin system would be bringing some features that are critical to me in an editor to helix (most notably VCS integration, something like nvim-lightspeed and a filetree). It seems the current plan is to embed scheme, because WASM component models are not stable enough yet. Therefore, I would like to propose a rust based plugin system: This approach allows plugin developers to use the full rust ecosystem. Furthermore, plugin authors could easily write "library plugins". These would be crates that depend on the The obvious drawback to rust based plugins would be the need for compiling these plugins. For people unfamiliar with rust/simple plugins, a scripting language could still be added to helix in the future (WASM, scheme or something else). I have many more thoughts/ideas regarding the detailed design and comparisons to other approaches, but I just wanted to share my basic idea and gather your feedback. Could you see this as an approach being a good fit for helix? Because this is a pretty long post, a short summary (with some added points):
|
Beta Was this translation helpful? Give feedback.
-
I'm Just ordinary user chiming in. From the description from on https://github.com/bytecodealliance/cargo-component , the components model came up because they needed to wrap WebAssembly modules. It seems like there is some need to make a wit-bindgen like tool for the components model, so some solution should arrive soon. Herein, I try collect in one place, summary of sub-discussions for quick reference, with links included inline to the actual sub-discussions. Plugin language options
The case for plugin-provided-feature
The case for in-core-feature
List of candidate plugins
List of conventional-plugin-features gone in-core
Desirable characteristics of a plugin system
Projects that are noteworthy for their plugin system implementation
Other discussions
so... where we at? Q1) Is choosing a plugin language now, just a temporary stop gap for small simple plugins until wasm matures, just to buy time for an eventual later migration? Q2) neovim has both a lua and vimscript engine. Would helix be able to have multiple simultaneous plugin language engines, perhaps aiding transition if the afore-said stop-gap were to be retired? Q3) Would the plugin api be designed to be so that it mimics vscode so that as many plugins from vscode eco-system be easily ported? Q4) If lapce (a gui code-editor like vscode) is going with wasm, wouldn't that also allow easy script sharing and porting with helix (and also kakoune if it gets a wasm plugin engine)? Q5) Would plugin system allow for dynamic load/unload or one time load on startup? notes
Helix holds much promise. thx to the developers P.S.
|
Beta Was this translation helpful? Give feedback.
-
I say this with zero interest in attempting to rush or apply pressure on any of the maintainers of this project, only as someone who is considering using helix as my primary editor(because its really cool, and of all of the things I've tried is the only one that "just works"): is there any kind of rough estimate on when a plugin system might emerge? I don't mean dates, just the general scope of it. Are we talking weeks/months/years? |
Beta Was this translation helpful? Give feedback.
-
Also: stick with WASM plugins, IMO :) If we want to take Helix with us into the future, we should lean into WASM. |
Beta Was this translation helpful? Give feedback.
-
I have a question... I don't have a terribly strong opinion about what language helix ends up using long-term. However, it appears to me that no matter what ends up happening, it will take a significant amount of time. Is there any possibility for any sort of short-term solution? In particular one idea I had was to be able to write something in rust that has access to all of the helix commands as functions, and just be able to compile that to some target and put it in the .config/helix directory. I'm far from an expert on rust development in general or helix's development specifically, but since the codebase is written in rust it doesn't seem like much work would have to be done to expose these functions. No need to write a whole api spec or anything like that. It definitely wouldn't be the best idea in the long run, but the idea would just be to give the users some way to script until a more formal solution comes about. It obviously wouldn't have to be that idea either. I just would like to know if there's any possibility of something to give us the ability to script something until the plugin system is ready. Because it looks like it may be a long time before that happens. |
Beta Was this translation helpful? Give feedback.
-
https://bytecodealliance.org/articles/wasmtime-1-0-fast-safe-and-production-ready |
Beta Was this translation helpful? Give feedback.
-
EDIT: I seem to have come across as trolling or hurtful to some people and for that I apologize. I did not mean to sound overly critical, and should not have implied that overall progress has stagnated, which is obviously wrong: What I meant was that progress on this particular issue seems to be slow, and I can't wait to find out what direction this will take and in what time frame it will happen. First of all: I love the Helix project and wish it nothing but the best. I personally haven't yet invested that much time into learning vim (only dabbled so far), but I really want to learn one modal editor to use for most of/all of my programming in the future. I have been following Helix since the beginning of this year, and really like what it already is! Totally fine if "competing" with Neovim is not a goal of this project, but I would really like to know if that's the case and what the vision for this project really is. If a plugin system is something that's far off, like potentially years away, I would like that to be clarified as that would mean that this is not the right fit for me, personally. ThePrimeagen pointed out in one of his recent videos that one of the great points about learning vim is its ubiquity on all platforms. Of course that grew out of it having been used for decades, and helix might never reach that point – but I'd like to know if helix even aims that high or if this is just kind of an experimental project that's not really intended for mainstream use. Fine either way, but I'd really like to know where the project's core developers stand with regards to this. |
Beta Was this translation helpful? Give feedback.
-
[Summarizing a conversation from Matrix for informational purposes] Unless I misinterpreted something, it looks like the decision to not use wasm was mainly due to the lack of a standardized interface. Using wasm only opens up the possibility of multi-language support, but it's not automatic due to the lack of the interface types. So I shared what looks like a workaround of this issue that I've seen in the past. graph-node has a wasm runtime. It's not exactly a plugin system, but it does expose a wasm API and runs user wasm code (so sandboxing is a hard requirement). Instead of defining the interface in Rust, they're actually doing it in their target language AssemblyScript here in graph-ts, and in turn use a custom codegen tool to turn it back to Rust for use in the wasm host. This way AssemblyScript gets direct access to the API, and for any other language, they just have to implement another codegen tool for bridging the gap. Generalizing this approach further, we can declare the interface in a format like Obviously with this approach there's gonna be extra effort for supporting more languages. For that, @archseer acknowledged the value of settling on a single plugin language, and I agree. However, wasm has a lot more benefits other than just "multi-language". Performance and sandboxing (and thus a permission system) are extremely important in a plugin system too. We can totally settle on a single "officially supported" plugin language, and only maintain the codegen tool for that language. It's also future-proof if the plugin author community decides that another language is better - no backward compatibility concern at all. |
Beta Was this translation helpful? Give feedback.
-
I'm going to make a suggestion that maybe Helix doesn't need an extension system at all. The problem with extension systems is straightforward: They reduce velocity because they increase the consequences of breaking backwards compatibility (since existing extensions will be impacted by changes that aren't backwards compatible). In specific terms, they direct text editor developers efforts towards extension API maintenance, and away from feature development. What about the fact that most (all?) successful text editors have extension systems? I've written about the rise of extension-based editors (see "the Text Editor as Platform"). In that piece, I make the case that VS Code has pushed the extension-based editor as far as it can go. In short, as always happens with innovation, the design space of extension-based editors has now been exhausted. An extension-based system in Helix will put it up against VS Code in design approach. This is a match that Helix will always lose, because one, Helix wasn't formed around extensions at its inception like VS Code was (and creations always bear the characteristics of their inception in perpetuity). But also simply because of the constraints of the format itself, since a web-based editor has a lingua franca of GUI customization (HTML/JS) with no equivalent for a TUI editor. It's always a stronger approach, especially at the beginning, to focus on your strengths, over shoring up your weaknesses (a later concern). In my opinion, Helix's strongest advantages today is that it achieves a tremendous quality and power while not yet taking on the baggage of an extension system. Another reason all other successful editors have historically had extension systems is because, until recently, they needed them! There was no consolidation about how languages were supported in an editor. So extension systems needed to exist to implement the glue code between how various linters, autocompletion systems, and other tooling interfaced with the editor. Now that language server protocols have largely consolidated how those features are implemented, the case for an extension system is a lot weaker. When a paradigm shifts arises, in this case, text editors moving beyond the need for extension systems, it's because the technology landscape has changed in a fundamental way. LSP is that change. Beat your enemies, not by playing their game, but by changing the rules of the game (just having fun here, I certainly don't think anyone should think of VS Code as an enemy). In this case that means continuing to build new core features at the same amazing quality level of Helix's existing features. VS Code can't do this themselves, because the VS Code team has to maintain their extension system. Zig when they zag. |
Beta Was this translation helpful? Give feedback.
-
Has anybody considered Python? I've dabbled with pyO3 and the interop with Rust is fairly painless. It's seamless interop is one of the things I like about Rust. Also, python is more popular than Lua and more mature than wasm. Although caveats of course is you're still limited by the GIL, and it uses your local python interpreter, so varying local python setups might make the user experience inconsistent, but I suspect that can be circumvented somewhat with virtual environments. |
Beta Was this translation helpful? Give feedback.
-
My Mac brew environment now has python 3.7, 3.8, 3.9 and even 3.10. It's a pain to keep a stable python environment around as the scripting system for Helix. |
Beta Was this translation helpful? Give feedback.
-
Cloud Build - pure Rust helix pluginsNot sure if Cloud Build has been suggested yet. Prior artBoth BetaFlight (v4.4) and ExpressLRS (v3.3) have recently introduced Cloud Build. Both projects deal with MCUs:
Their motivation was overcoming flash space limitations on cheaper MCUs, while being able to add features (= more bytes) for top notch hardware as well as support a wider variety of features such as new models of microcontrollers and peripherals, such as gyroscopes, accelerometers and GNSS systems as well as new protocols for communicating between the MCU and the various hardware peripherals. Applicability to helixLike helix plugins, BetaFlight and ExpressLRS features must have the lowest possible latency and be baked into the core software as tightly as possible. In this discussion, many proposals had to be rejected due to size, RPC overhead, serialize/unserialize/marshal/unmarshal costs and the lack of a stable ABI. Other options involve more or less esoteric programming languages, where obviously Rust would be the best choice if just we could circumvent the need for users to have toolchains available and compile helix with their own set of plugins. How it worksIn BetaFlight and ExpressLRS, it works like this:
The CI costs are covered by donations. BootstrappingBetaFlight and ExpressLRS both use a "configurator", which is either an Electron app or a PWA with USB access for flashing hardware. For helix, I would imagine this to be either a plain web app, or (probably not?) part of the helix binary. As a third option, a tiny bootstrapper CLI can be published, which is only used to pick plugins and then download helix for you from Cloud Build. But using a small web app appears to me to be the best solution. It would provide UI for the following steps:
Benefits for helixA Cloud Build solution would allow for helix plugins to be written in pure Rust, without requiring users to have toolchains installed. |
Beta Was this translation helpful? Give feedback.
-
Who are your potential plug-in writers? What would be the easiest solution form them? I do not know if a Helix user survey exist, but I suppose most of us have a modal editing background. Very likely we come from Vim, then Neovim and end up with Helix (for good reasons). Probably most of us have some Lua experience we could easily build on. At the same time I think we have very few users coming from Emacs mastering Lisp. Furthermore, I can imagine many of us have some notion of Rust. As these are just my personal assumptions, shouldn't we make a survey what plug-in language our users are actually familiar with? The plug-in extension is planned for some audience; shouldn't we know more about them? Once we know what is the easiest solution for our target audience, the chances are high to motivate more people to write fancy plug-ins. A simple survey could be realized in a "discussion" thread. |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Hi! Did you take a look at what Kirottu/anyrun does for its plugin system? It's quite limited compared to what you'd want to have when builtin plugins for a text editor, rather than an application launcher, but is still quite a good start. This would still assume that most people know how to use Rust extensively, and quite opposed to the idea of @getreu where we could poll potential plugin developers (perhaps we could use FFIs to integrate with more languages like Lua?) |
Beta Was this translation helpful? Give feedback.
-
Btw deno is also written in rust and it's ready for embedding in other projects. Plugins in js/ts will be good, soydev friendly addition 🙃 |
Beta Was this translation helpful? Give feedback.
-
is nickel a good fit for this use case? |
Beta Was this translation helpful? Give feedback.
-
While a lot has been said already, want to throw Mojo on the radar. Coming from neovim, i really value they have added lua as its perfect to be embedded and has a jit to be fast. Mojo wants to address pythons performance , while being a superset of python. Read more here. |
Beta Was this translation helpful? Give feedback.
-
its seem no one suggest scripting language like dascript or quirrel (the fork squirrel) both are made by a company who uses it in their products, not some random guy writing scripting language in the weekends and no lua please, i have a nightmare writing neovim plugin because 1 based array indexing. |
Beta Was this translation helpful? Give feedback.
-
Can we use this / learn from it? Plugin User Experience (UX) | IntelliJ Platform Plugin (Link corrected). |
Beta Was this translation helpful? Give feedback.
-
Might I ask, what sort of interface would these hypothetical plugin system use? If we assume that the language is chosen, what API would it be able to access? Should plugins be for language specific code, things that the helix maintainer do not want to provide themselves? Would it allow creation of custom UI's
I really like this editor. If it had parinfer or something like it, I would be using it now instead of Neovim. These are just some ideas. Personally I would like to use Helix to edit some lisp code, as I am reading SICP |
Beta Was this translation helpful? Give feedback.
-
IMO plugins systems are tarpit. Have people considered just "write more Rust, recompile the app?" as an approach? I.e. think of the editor as a library, combine with other libraries, and then just slap on a very small boilerplate |
Beta Was this translation helpful? Give feedback.
-
IMHO, continue discussing on this thread will not have a consensus. Why not just take the python community routine, Benevolent Dictator For Life, the helix creators decide what to use. If the scheme is the one to go, then that's it. In the future API design, expose the |
Beta Was this translation helpful? Give feedback.
-
What about using wasm/wasi/wasix, it have good build-in support and for other languages. For things like js/lua/python it would be possible to just embed runtimes like deno into plugin using wasix (so for example all scripts written in js would require a plugin to run and provide access to helix apis). Also |
Beta Was this translation helpful? Give feedback.
-
As I said in the earlier thread, I think the implementation details(language/runtime) of the plugin system are not important as this stage. First we need to figure out what sort of features we would like to enable with this plugin system, then define a plugin API that allows these features to be implemented and then finally the implementation details(language/runtime etc) can be considered. A plugin system is a huge undertaking which is why I think it is best to pick one feature, for example source control, and implement a plugin system just for that feature OR pick an existing feature and make it modifiable using a plugin. I feel like both of the plugin threads have been unintentionally derailed by people listing their favourite scripting languages and/or runtimes. The difficult part is going to be deciding the scope and capabilities of the plugin system and how it will affect the vibe of the editor. A lot of people have praised helix for its ease-of-setup compared to neovim or emacs. Something to keep in mind. |
Beta Was this translation helpful? Give feedback.
-
This thread has devolved into language popularity discussions and most options have been mentioned multiple times already (and no, we won't pick XYZ because it's your favourite language). I've kept the discussion open because there's occasionally been an interesting comment or project mention. But as the discussion grew older ideas would get buried in the backlog and brought up again several times. Since each post on this thread pings a couple hundred of us subscribed to the discussion I'm going to lock the issue for the time being. If you'd like to have a technical discussion on the implementation we're always available on Matrix. I plan to write a longer post that discusses alternatives we've considered (including WASM) and the design constraints chosen but we're currently leaning towards a Scheme-like implementation (in fact @mattwparas in #3806 (comment) has already implemented a nice prototype that even covers a vim-dirvish-like file tree, the furthest any of the plugin system attempts has gotten).
Helix is a pragmatic editor: it should behave as you'd expect out of the box, and I don't expect users to write significant amounts of Scheme unless they're plugin authors (yak shaving over thousands of lines of config files is precisely why the average user has switched to helix!). In fact the core has been extensible enough that we haven't seriously needed a plugin system yet. But I'd still like to provide a plugin system flexible enough to extend the editor for less common usecases Why not WASM: WebAssembly is popular but it's not the magic solution to every problem. We need to expose a very large ABI to the language and since there isn't a cross language compatible memory layout we'd still end up being locked into a single language running on top of WASM (or the maintenance burden of multiple shims to support other languages). We'd only be getting the benefits of WASM's VM and we'd be importing projects orders of magnitude bigger than the editor itself. It's not clear to me if the tradeoff would be worth it. Even if we were able to support multiple languages via WASM, it seems better to me to focus on a single language so the ecosystem doesn't fragment into smaller parts where each plugin I'd be running could be in a different language, making contribution a lot harder. Why not compiled plugins: The scripting language should also be used for configuration. While there's software that does this (e.g. |
Beta Was this translation helpful? Give feedback.
This thread has devolved into language popularity discussions and most options have been mentioned multiple times already (and no, we won't pick XYZ because it's your favourite language).
I've kept the discussion open because there's occasionally been an interesting comment or project mention. But as the discussion grew older ideas would get buried in the backlog and brought up again several times. Since each post on this thread pings a couple hundred of us subscribed to the discussion I'm going to lock the issue for the time being. If you'd like to have a technical discussion on the implementation we're always available on Matrix.
I plan to write a longer post that discusses alternative…