Hi, I Just started working on a Emacs-inspired text editor in Rust.

Being insipred by Emacs, the most important part Is the possibiliy to implement new components.

My ideas were:

  • Rust-based scripting language, like Rhai
  • RustPython (slower, but more compatible and lots of people know Python)
  • PyO3 (Bigger executable and not that fast)
  • Wasm/Wasi (Cross-platform, but I don’t know if the compatibility with Rust’s hosted functions and structs is good)
  • Other binded language, like V8, Lua or SpiderMonkey
  • Compiled plugins, like .so or .DLL (Fast, but not compatible; there should be Rust plugin frameworks for implementing this, but I don’t remember the name)

The elements to analyze are: speednees (consider it’s a text editor, so…), easy-to-develop and Cross-platform (if possible, not that important), but the possibility to execute functions in the host Rust program is EXTREMELY important.

Thoughts?

Thanks in Advance.

  • two_wheel2
    link
    fedilink
    English
    arrow-up
    7
    ·
    1 year ago

    One thing I’ve been thinking about in this area is you could make the “plugin system” completely compiled. Users would have some toml or .rs file they would change and point the rust compiler at a directory and come out with a new binary. You could still add in a “Lua plugin” plugin which enables lua-based plugins without forcing all users to pull down the gear required to use that in rust. It would also make it possible for people to create various “distributions” of the editor with varying complexity and size depending on user needs

  • Barbacamanitu@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    I’d say something like LUA or python so people could easily write their own plug-ins. If speed really is a concern then I’d go with wasm.

  • two_wheel2
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    I’ve been thinking about exactly this for a long time. My only thoughts are you should check out helix to see what you can learn from them if you haven’t already, and you should post or dm me the repo so I can see if there’s anything I can help with!

  • vilcans@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    One way to implement Rust-based “plugins” is to turn the whole application/plugins relation on its head: Publish the main application as a crate, which lets the user build their own executable that uses the main application as a library. That way they can customize the app however they like, if the main app just has hooks for it.

  • flying_platypus@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I think helix has been talking a lot about this issue too. Their solution, as far as I understand it, is to use a LISP language for scripting and extensibility and a wasm plugin system for performance critical plugins. Not sure how far it is into implementation, but something to look out for.

  • dahas@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    It’s not exactly what you are looking for, but you could check emacs-ng. It tries to replace some of emacs’ internals with rust and expand the possible scripting lenguajes that can be used with it.