Replies: 195 comments
-
I think the most basic demo would be implementing one of the existing commands in such a way, e.g. helix/helix-term/src/commands.rs Lines 123 to 137 in 407b37c It only depends on the Context , and it only uses functions from core (move_horizontally) without interacting with the UI. I think most of the primitives in core should be exposed (selection/range/transaction/etc) and we can have a subset of view exposed (retrieving a selection from a doc, applying transactions)
|
Beta Was this translation helpful? Give feedback.
-
Mentioned on Matrix:
|
Beta Was this translation helpful? Give feedback.
-
What benefit does this provide over binary plugins? Will plugins be able to access eachother's state (functions, variables etc.) in the same way that plugins programmed in a single language (e.g. emacs) are able to, or something else? My bad if the answer is obvious btw. I'm not very familiar with WebAssembly or plugin architectures. |
Beta Was this translation helpful? Give feedback.
-
I think this post explains it well. There's a lot of uncharted ground in regards to plugin systems, especially with sharing state, but you can see past discussion on this here. |
Beta Was this translation helpful? Give feedback.
-
@kirawi |
Beta Was this translation helpful? Give feedback.
-
If you want to embed the wasm compiler with the binary or as library etc, I would advise against wasm due to slower speed and missing performance optimisations on many targets. "Of course, wasm3 runs fine on aarch64, but at about 3% of native speed." This benchmark shows very astonishingly the missing optimisations that luajit can do here using this lua libary. Also it would be advisable to have execution time benchmarks of webassembly against all usable alternatives before making a decision (ie by listing some speed and platform compatibility requirements). Would be not very useful to end up with something significantly slower than neovim. |
Beta Was this translation helpful? Give feedback.
-
The intention is to use Lua lacks multithreading, SIMD, and has a smaller ecosystem. It's a lot more convenient to enable users to opt for their favourite language rather than have them learn a separate language and its ecosystem. I can't speak on behalf of everyone, but I believe that most Rustaceans firmly agree with me, as many libraries have wasm as a compile target. I would say we collectively have a lot more experience with wasm as a whole. |
Beta Was this translation helpful? Give feedback.
-
We'll probably go with
Given that Cranelift code generator is still very young and already that good, I'm not too afraid. Furthermore performance tracking is a thing at the bytecodealliance. Besides all the other good points made by @kirawi on performance, I really like the ecosystem argument which is the reason why we want to use WASM in the first place. Given that performance is probably good enough (or more than enough), the main focus should be on whether user/developer experience is good. |
Beta Was this translation helpful? Give feedback.
-
Thanks for considering Wasmer! We are working on a set of benchmarks at the moment, we had two bugs that prevented Wasmer to shine in the one you showcased @CBenoit, but those are already solved in Right now Wasmer is about 20~30% faster than the other runtimes when using the LLVM compiler! In general, we recommend Cranelift if the compilation times need to be fast (that is mainly for development), and LLVM for production (similar to how Rust uses LLVM always to compile in release mode, and Cranelift as an experimental compiler for faster compilation times in debug mode) :) |
Beta Was this translation helpful? Give feedback.
-
This is a question I've had for a while, but what is the main difference between |
Beta Was this translation helpful? Give feedback.
-
Thank you @syrusakbary for your input!
I'm interested in hearing more as well! I was more in favor of
On the other hand,
I'll also ask on Veloren's Discord why they decided to use I also found this article published a few months ago:
|
Beta Was this translation helpful? Give feedback.
-
@CBenoit @kirawi There are 2 mutual exclusive possible use cases for WASM for plugins, where one really wants to have a plugin manager: 1. shipped compiler or 2. hook into the repo build system and the used compiler to build the WASM libraries/binaries.
Solution 1. gives more of a "it always works" experience with the language that the compiler supports Solution 2. gives more of a "its super fast", but needs some setup and might break. Unless you can use nix for 2. ie with flakes 2 is just painful due to 2.1 many distros not shipping all compilers or only specific versions and then you are stuck on one (ie not yet stable languages) and 2.2 you want to simplify build system stuff for plugin developers. nix with flakes is the de-facto best solution for 2.1 (shipping compilers+libc(s)? and make sure they exist, are configured/build identically and up-to date enough for the plugin ecosystem). Ask yourself which solution is better for the goals of the project helix or how you want to deal with the mess of 1. shipping compilers and 2. supporting the build systems of plugins. |
Beta Was this translation helpful? Give feedback.
-
We won't be shipping a compiler, though? WASM is a compile target for Rust itself as Did I understand you correctly? |
Beta Was this translation helpful? Give feedback.
-
@kirawi How does this change the problem, when the plugin is written in a language that the distribution doesnt ship a compiler (or super old/incompatible or slow libc etc) ? |
Beta Was this translation helpful? Give feedback.
-
No, it's just |
Beta Was this translation helpful? Give feedback.
-
@theherk I didn't say they can only be implemented as plugins. I'm saying that a plugin system is likely the only scalable solution because there are a million plugins that one could want and the dev team for helix is probably going to be too small to either implement everything we might want themselves or review every single pr to merge into the core. Obviously the ideal scenario is that we get everything we want implemented in core but that's a fantasy, and even if we could get a particular plugin in core it still wouldn't be ideal because there are different ways of implementing different features with different tradeoffs and if it's all in core then you're stuck using whatever was implemented with no hope of something else. Consider neovim's major implementations of org-mode: There's this one and this one. Now I haven't used them, I don't know what the differences are between these but presumably there are some and the point is, as a neovim user you have a choice which one you want to use and which one is better for you -- and the only reason this is possible is because two different teams created two different plugins as opposed to one team implementing one core feature set. Do you not think it makes more sense to let the dev team work on making the core editor better by fixing bugs and improving architecture rather than worry about implementing magit? I think there's enough to work to be done in the core platform and if the dev team spread themselves thin working on everything under the sun if would be counterproductive. |
Beta Was this translation helpful? Give feedback.
-
Honestly this issue has so much difference of opinion, no matter what ends up happening, there will probably be a lot of unhappy people. In my opinion, this issue doesn't need more user feedback, it just needs a decision and an implementation. |
Beta Was this translation helpful? Give feedback.
-
@dead10ck Isn't it already happening? @archseer is implementing a scheme on rust. |
Beta Was this translation helpful? Give feedback.
-
is there any repository or pull request to track what is done and what is not ? |
Beta Was this translation helpful? Give feedback.
-
did any one check nushell plugins ? |
Beta Was this translation helpful? Give feedback.
-
Just putting lapce out there. |
Beta Was this translation helpful? Give feedback.
-
From that webpage: "Vim users, we've got you covered! Built-in support for a Vim like editing experience, without a plugin." |
Beta Was this translation helpful? Give feedback.
-
Correct, it supports Vim keybindings without a plugin, but it also supports WASI plugins |
Beta Was this translation helpful? Give feedback.
-
Also from that webpage: "WASI plugin system |
Beta Was this translation helpful? Give feedback.
-
@devanlooches: Maybe you have some insider information, but I was under the impression they were only slightly further along by having decided on the definite inclusion of a WASI plugin system. But the API and implementation are very not done. lapce/lapce#558 |
Beta Was this translation helpful? Give feedback.
-
Ah I see. I only took a quick glance and saw it on the website. I was under the impression it was more completely since there was already a crate on crates.io. lapce-plugin |
Beta Was this translation helpful? Give feedback.
-
I believe that this issue would be better served by a proper discussion. I would urge anyone with comments not pertaining to the implementation to use #3806 instead. Additionally, it might be wise to create a new issue altogether for the plugin system. There's a lot of noise here, and focus has shifted from WebAssembly to other alternatives. |
Beta Was this translation helpful? Give feedback.
-
@kirawi Discussion is now fragmented between #122, #3806 and #2949 :/ I also agree with #122 (comment), at this point opinions are being repeated and we don't really need more input, rather development time has to be spent on an implementation. |
Beta Was this translation helpful? Give feedback.
-
I stumbled upon zellij, which has a WebAssembly plugin system implemented, maybe it can be used as a reference. |
Beta Was this translation helpful? Give feedback.
-
It’s mentioned in the very first post. It’s not against anyone, but for now I think it’s best to lock this issue until further concrete progress is made (see #122 (comment) and #122 (comment) for why). Of course, feel free to comment in the discussion #3806 or to join the Matrix Space, just try to not forget using Ctrl-f in this issue beforehand. I’m not locking to prevent any further discussion from users, but rather to make it obvious to everyone that we already collected most of the opinions and suggestions and that what we really need now is development time. |
Beta Was this translation helpful? Give feedback.
-
Basically load
.wasm
files.Capabilities:
At first we could use a basic toml config file or CLI to feed .wasm files to the editor.
A way to configure permissions on a plugin basis could be investigated to use the sandboxing capabilities coming with WASM.
Example with
wasmtime
:(reference)
I think the biggest challenge is to get well-defined interfaces down but let's not fear to break it during early stages.
Later we could investigate embedding a wasm-based scripting language such as Grain or AssemblyScript.
Here are some references:
wasmtime
andwasmer
I'm willing to experiment soon
Beta Was this translation helpful? Give feedback.
All reactions