-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPC-based Plugin System #998
Comments
It looks like LSP architecture but for interacting with editor instead of per language. :) |
If it's okay, I'll add my real-world use case that I have with Neovim. I switch from light/dark appearance in macOS depending on a few factors [1]. I've written a little binary [2] that runs and listens for appearance change events and then tells Neovim [3] to change the theme to the appropriate light/dark one. [1] macOS default change based on sunrise/sunset, but also just depending on the weather and lighting where ever I currently am. |
Can we just implement a dead simple pipe based interface which will be trivial to maintain over the long term even when a more complex plugin system gets implemented? I'm thinking something like a pipe file which is read line-wise as a command. It would go through the same code flow as manually entering a command, but the actual command would just be sourced from the pipe. helix is already dependent upon Something like this seems like it would be easy to maintain. It could be kept in even after a more robust plugin system has been implemented because it's low cost. For some tasks, this might even be preferable to writing a full plugin as it is easily automated by end users. You wouldn't have to understand the inner working of helix's plugin system to automate a simple task. You just have to understand the commands available. Something like this would reload the theme when it is written to which will improve designer experience: while :; do
inotifywait -e modify ~/.config/helix/themes/mytheme.toml
find "${XDG_RUNTIME_DIR-/tmp}/helix/pipes" -mindepth 1 \
| while read hxpipe; do
echo 'theme mytheme' > "$hxpipe"
done
done |
Just to chime in gRPC might be a good option. It can be run over various transports e.g. pipes/sockets or http. It also has client-server generators for multiple languages including rust. |
Shameless plug, but my crate |
Closing, see #3806 (reply in thread) |
In addition to #122, it would be nice to make it possible to implement plugins through an RPC interface like in Neovim. One major benefit from this is that it would make it easier to use scripting languages like Python as the compiler wouldn't need to be compiled down to WebAssembly. Another potential use is that external programs or plugins (not sandboxed) can directly work with Helix. If we accept this as a feature we'd like for Helix to have, I think that it would be best for it to be implemented as a WebAssembly plugin.
See #387 for a real-world use case.
The text was updated successfully, but these errors were encountered: