-
mort
https://upload.yax.im/upload/Val8Kddtue-xdlOU6PfaIoi9/Screenshot%202026-10-14%20at%2002.27.00.jpg
-
koru
> I imagine a system where an extension is a directory similar to today's extension, with an extension.toml file and themes/, language/ and snippets/ folders that works as today, but with a src/extension.rn file or something where that extension.rn file can expose functions like language_server_command(), language_server_initialization_options(), etc like the current zed_extension_api::Extension trait but implemented using rune (https://rune-rs.github.io/), a nice little embeddable Rust-like scripting language Hm, why not Lua, Scheme or native Rust (w/o std)? I like idea of WASM plugins, but it's heavy. ↺
-
mort
Compared to Scheme, Rune is a "normal language" which won't put people off as much. Compared to Lua, Rune is a language whose implementation is written in Rust, making integration easier than e.g luajit. Native Rust, that still requires wasm and a Rust compiler, right? But might be a bit lighter because it might not require wash?✎ -
mort
Compared to Scheme, Rune is a "normal language" which won't put people off as much. Compared to Lua, Rune is a language whose implementation is written in Rust, making integration easier than e.g luajit. Native Rust, that still requires wasm and a Rust compiler, right? But might be a bit lighter because it might not require wasi? ✏
-
mort
Anyway I'm just messing around right now and seeing what happens, rune was the language I landed on for experimentation. I'm totally up for changing it if this turns out to be a viable path. Lua is probably my preferred alternative, I think it would be a good choice too
-
mort
I looked at rhai too (https://github.com/rhaiscript/rhai) but it smells a bit too AI for my taste
-
koru
Lua already have a lot of "users" from Vim (and other tools and even games) and have all tools (LSP, linters, etc.). See also: https://crates.io/crates/mlua
-
mort
You're probably right
-
mort
I found the rune language elegant and avoiding another C dependency appeals to me. But using a language everyone already knows and which LSP bindings are already written for is probably more pragmatic
-
mort
How does mlua work by the way, does it end up adding a dynamic dependency on a system lua interpreter? I'm used to C bindings being these horrible things in Go which I've learned to avoid at all cost to simplify both distribution and compilation, but it seems like less of an issue in Rust somehow
-
koru
mlua is used in Yazi as plugin system and as I know do not require system Lua
-
mort
Okay yeah mlua depends on mlua-sys which depends on lua-src which contains all the C code. So it gets compiled into the project. Nice
-
koru
Nice
-
mort
I wonder how hard it would be to get most of nvim-lspconfig to work in gram..
-
krig
lua was the first language I considered, I have used it many times before in other projects and yeah coming from neovim it works well there. The main reason to avoid it would just be the C dependency, compilation for all the platforms gets a bit more complex etc. But sticking with a language that people know has a lot of benefits that maybe outweighs all that. Plus lua is done, no risk of a total rewrite breaking everything or it getting abandoned.
-
ashleytg
will gram plugins ever not require providing a repo link?
-
krig
Well, you don’t have to do that now either, you can install from a local directory. But eventually I want to allow adding extension registries and installing directly from the application, because I want to allow updates and picking versions explicitly and so on. If we install from a git repository we can keep tracking the remote and check for updates and other tags and branches, display the changelog and so on. But I also want to allow adding extensions from the settings at some point. We have to figure out a good security model for everything as well though. Right now projects can add or change settings without letting the user know which needs to be fixed. My vague plan right now is to add a central permission store and change the implementations for IO in extensions so they request permission to do things like run an executable or download something. Then the user would have to explicity allow that and can do things like “allow this specific extension permission to download things only from urls that start with codeberg.org.. once / in this project / always”
-
mort
https://upload.yax.im/upload/zmMvsnRV1jS9w4KeoqTorPcm/Screenshot%202026-10-14%20at%2010.39.00.jpg
-
koru
mort, is that mlua?
-
mort
Yeah
-
mort
https://codeberg.org/xmort/gram/commit/e141ecfea83c94053861ccd49426564bbb6d0ddf all of the hard stuff is just stubbed out but filling it in doesn't seem infeasible, just bridging the functions from the Extension trait with the Lua
-
koru
Can you do something or it's only `print` available?
-
mort
Well it has all of Lua but no interaction with Gram yet
-
koru
Why not LuaJIT? https://codeberg.org/xmort/gram/src/commit/e141ecfea83c94053861ccd49426564bbb6d0ddf/Cargo.toml#L221
-
mort
Normal Lua can execute pretty much anywhere as long as there's a C compiler, the JIT needs a bespoke back-end per platform, and JITs are just so much more complicated in general, I didn't feel any performance gain was worth it. Not expecting Lua to be doing a lot of time consuming computation
-
mort
But I mean it should be pretty easy to swap out, I don't have strong opinions on it. Just had to pick something
❤ 1 -
krig
I think sticking to just lua is fine honestly, I doubt extensions are ever going to be performance sensitive. At least the API now is completely off any hot path, the extension just provides a path to an LSP binary and then the editor talks to the LSP directly
-
krig
Will look at your branch as soon as I have time but it looks very promising! I would want to sandbox lua so any IO goes through the editor and can be permission gated, but that should be doable
-
koru
Why not just make built-in LSP support (like that does Helix)?
-
koru
Helix is awesome, btw!
-
krig
Yeah I want to change how tree-sitter grammars are compiled and loaded to be more like helix
-
krig
and then rewrite all the builtin languages to be extensions so we don’t need to bundle any grammars
-
koru
Extensions are useful for something more than themes or LSPs, but I just want open config add any tools and go. Helix and Flow (only source build) support any stdin LSP without plugins (hope Helix get plugins system one day...) and close 99% of my needs now. Helix compile grammars one time after installation (yeah, you can use Helix without grammars and it's cool) and you can fetch new grammars after some time. Why not just drop extensions entire or am I missing something?
-
mort
100% agree on the IO thing, Lua should just be a completely sealed environment except for what Gram provides; anything it prints should be logged as log lines clearly coming from that excension
-
mort
How does helix deal with tree-sitter? I haven't managed to come up with a nice way to deal with potentially untrusted TS grammars that's better than "compile to wasm in a sandboxed VM, distribute the wasm blob and run it sandboxed"
-
krig
I would like to move some stuff to extensions actually.. like repl support: If eventually we get that in better shape it would be cool to have full repl support for lisps and scheme via extensions too. And I want to let extensions add settings and configuration
-
krig
Helix just compiles with a C compiler. Zero safety 😅 benefit is much simpler requirements on the user environment
-
krig
I have thought about the possibility of using an embedded tcc compiler that is very restrictive on what the grammar code can do…
-
krig
but at least we could lock to only compiling an explicit revision of a tree-sitter grammar, not just downloading and compiling the latest
-
mort
I used to think you could just take the tree-sitter grammar javascript files, run them in some sandboxed JS environment, then since you trust the TS code generator you trust the resulting C files so you can just compile and run them; but the fact that there's an escape hatch to inject your own C makes that so much less realistic
-
krig
same thing with LSPs… it’s insane to me that the editor now just downloads whatever the latest release is from github…
-
mort
yeah..
-
mort
that TCC idea is interesting, though you'd kinda need an implementation of "only the safe parts of libc" and then I'm not sure how you could possibly avoid letting the C code run arbitrary machine code which would let you run whatever syscalls you want
-
koru
I think create VM/sandbox just to compile tree sitter is overcomplicated. I like idea just pin/lock commit and verify hash of downloaded files.
-
mort
it's not like wasm is a monstrously complicated language fwiw, I feel like the only reason wasm runtimes are huge is that they're developed by web people. Maybe there are smaller wasm interpreters? TS shouldn't need wasi like the extensions do so it should be pretty well behaved
-
mort
like if TS grammars were written in lua I'd have no qualms about having a lua interpreter, there's no reason a wasm interpreter should be *bigger* than lua
-
koru
Offtop, but anyone saw Helix drama? https://github.com/helix-editor/helix/discussions/15408
-
mort
I don't really pay much attention to that project but it is of course disappointing that their maintainers don't seem to have any problems with adopting AI
-
Carrot
Im running into an error here: Language server eslint: The filename, directory name, or volume label syntax is incorrect. (os error 123) How do i fix this?
-
koru
Carrot, is your issue similar to https://codeberg.org/GramEditor/gram/issues/296#issuecomment-15115224 and https://codeberg.org/GramEditor/gram/issues/227?
-
Carrot
@karu no im sorry i forgot to have the extension be .tsx instead of .jsx, it works now
❤ 1 -
Carrot
wait im stupid, i thought that eslint was the reason why i dident have autocomplete in react
-
Carrot
idk what eslint does tbh
-
koru
Carrot, what you want to do?
-
koru
I mean trying to do.
-
Carrot
well eslint still doesent work, with the given error, but i dont know how important that is
-
Carrot
i guess il leave it ate that, since my problem is fixed
-
krig
When the LSP doesn’t work there are logs you can view that can be helpful to catch issues like that. But I don’t know if the logs would have helped in this case. eslint in particular is a bit bad where they keep making breaking changes to the linter and there is a bunch of code in the editor to handle specific versions…
-
mort
Is there a way to run a build of Gram while another instance is already running? And avoid the "Application with bundle ID already running" thing
-
krig
yeah set GRAM_STANDALONE=1, then it runs with a temporary database
-
krig
and should skip the bundle id check
-
mort
Oh nice!
-
mort
Wait that didn't seem to make a difference
-
krig
hm is that not it.. going from memory here
-
krig
sorry, GRAM_STATELESS
-
mort
Nice, that worked
-
mort
https://upload.yax.im/upload/essQOiLxZaMG1S7yXervKbCZ/Screenshot%202026-10-14%20at%2020.36.59.jpg
-
mort
Random thing, never seen it before but it might be a race condition due to missing busy timeout. Just logging here to not forget it, might be worth looking into
-
krig
hm yeah suspicious
-
mort
https://mort.coffee/home/sqlite-editions/#h2-bad-default-3-sqlite-busy-errors-with-concurrent-writers reminded me of this part in a blog post I wrote some months ago
-
krig
oh yeah I have a nice set of “better defaults” for sqlite that I usually set. I haven’t looked at what gram does..
-
mort
https://upload.yax.im/upload/mFMx-sy1GMxm7piMJ6roPr6u/Screenshot%202026-10-14%20at%2021.43.47.jpg
-
mort
That .. is a functional extension for Lua written in Lua
-
mort
https://upload.yax.im/upload/PHqCTFDPSwrUsAelB2iSrjLz/Screenshot%202026-10-14%20at%2021.44.35.jpg
-
mort
Like, I can go to definition in the editor using that extension, no wasm involved
-
mort
The right API here is almost certainly not to have separate functions like this, still in the experimentation phase
-
krig
Oh wow, that's awesome! Great progress @mort
-
krig
Could even imagine converting the simple builtin language support to embedded lua extensions then...
-
mort
https://codeberg.org/xmort/gram/pulls/1 made this just now to show the changes involved compared to main in case you're interested
-
krig
super cool, I'll take a look
-
krig
I'm travelling again this weekend so limited time to hack on stuff but I should be able to do PR review. I've pretty much halved the binary size since 3.3.0 so adding a lua interpreter shouldn't be a big deal as far as bloat goes.. the only concern I have really is to make sure it's at least basically sandboxed. But then again, the sandboxing in gram never actually worked (and is still completely broken in zed)
-
mort
I'll do some builds to compare both the binary size impact and the compile time impact of adding lua
-
krig
Very unscientific, but I just made bundled release builds without and with the lua patch, and the dmg bundle size is the same (58 MB) for both. The executable size is 178 MB without lua and 179 MB with lua
-
krig
didn't measure compile time though
-
mort
Comparing my main branch and my lua branch in release mode: compile times: 4m 57s -> 4m 54s (probably within margin of error, or maybe a weird incidental scheduling artefact), size grew by 304kiB from 179.45MiB to 179.75MiB
-
krig
ooh OK, the small binary size difference is because it's trying to dynamically link to lua.. and then crashes on startup
-
krig
"/opt/homebrew/Cellar/lua/5.5.1/lib/liblua.5.5.1.dylib' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs"
-
krig
interesting though! that's a tiny size increase
-
mort
Ohhh yes it links against that for me as well
-
krig
ahh right
-
krig
ok makes sense!
-
krig
looks like adding the `vendored` feature flag should work.. will try
-
mort
Trying the same myself
-
mort
180.01MiB
-
krig
nice!
-
mort
So a bit over half a meg then. Not nothing but not a ton (considering it's a whole language runtime hehe)
-
krig
yeah if the goal is to eventually remove the Wasm extensions the end result will be huge savings anyway..
-
mort
4m 58s now with the vendor feature
-
willowispll
Hello! Im really grateful for your work. It feels so good to use an editor without being exposed with ai into my face lol.
-
krig
Hi, and welcome!
-
willowispll
Ive been using zed for quite a while but gram feels so refreshing! And i also like the mascot(?)
-
krig
It’s the most important feature 😄
-
willowispll
If you need any help with testing or something like that im always ready!
-
krig
Help is always welcome! so far I haven’t really done any pre-release builds, I just tag a new release when it feels like a good time.. but I think I might tag one pretty soon. But any help testing and finding issues is super valuable
-
mort
I ripped out wasm extensions and wasm support in tree-sitter, it's a horrible hack-job I wanted to get some numbers of Gram built completely without wasmtime. A release build took 4m 27s (down from the current ~5 minutes), binary size went down to 136.9MiB (down from ~180MiB), debug build was 3m 54s. So that's what's at the end of this road. Significant, but I was honestly hoping for more. But I think at that point it's really Gram itself which dominates
-
willowispll
hm, interesting
-
willowispll
can u share pictures here?
-
mort
yeah
-
mort
Wait was that an XMPP question or a request for me to share pictures? I responded as if it was the former, you can share pictures over XMPP :p
-
willowispll
XMPP question its my first time
-
willowispll
well, idk how to do it so ill just share it in text in my closure: NAR Size: 275.22 MiB | Closure Size: 349.95 MiB | Added Size: 275.22 MiB
-
willowispll
and honestly, its already impressive to me
-
willowispll
Its for gram-3.3.0
-
willowispll
talking about this: https://codeberg.org/GramEditor/gram/issues/29 i think it can be good to have a dev. environment and a package that targets main branch, if you dont mind i can do this
-
willowispll
or i can also ask the current nixpkgs maintainer for gram
-
krig
oh yeah I’ve done a lot of work since 3.3 to reduce the binary size
-
willowispll
yeah the comparison is amazing zed: NAR Size: 357.77 MiB | Closure Size: 1.45 GiB | Added Size: 1.45 GiB
-
krig
they keep adding stuff and I keep removing stuff :D
-
mort
How do you feel about the wasm-less numbers?
-
willowispll
at least you added the toad!
-
willowispll
im amazed, but i still miss only 1 feature, xd
-
willowispll
but everything else is just better
-
mort
What one feature?
-
willowispll
Build-in hare support
-
willowispll
At the end its a problem of my weird setup
-
mort
Oh, you use Hare? I've read about it and it seems interesting but I never tried it out
-
willowispll
I do! Im writing my own init system in hare and i have to use helix or zed for it, gram extensions dont work coz of my weird nixos setup
-
mort
Sounds like a cool project!
-
krig
@mort maybe I was expecting a bit more… but from measuring a big part are all the bundled tree-sitter grammars. Switching to helix-style compilation of grammars on demand instead along with the Lua extensions should make a huge difference
-
krig
@willowispll sounds cool! yeah I’ve wanted to try hare but I’m on mac still and I didn’t get the mac version working last I checked it out. I won’t be getting more Macs though so should be back on Linux eventually..
-
krig
or some *BSD I guess, depending on what happens with Linux.. things are looking grim
-
willowispll
I wish i had more rust knowledge to pr myself but i have what i have sadly
-
willowispll
yeah makes sense
-
krig
is there an LSP for hare?
-
willowispll
https://sr.ht/~whynothugo/hare-lsp/ this is the up-to date one
-
krig
if there’s a tree-sitter grammar I should be able to add basic support at least
-
willowispll
i mostly need only this feature from the lsp ``` textDocument/hover: returns info for symbol under cursor. for variables of inferred type, only shows <inferred>. ```
-
krig
it should be doable i feel like.. let me take a look at it
-
willowispll
``` Tree sitter A tree sitter grammar for Hare is available here. https://git.sr.ht/~ecs/tree-sitter-hare ```
-
krig
Hm.. 2 years old, it might not have the API gram expects
-
willowispll
what zed uses?
-
krig
will give it a try though
-
willowispll
tysm! i hope i dont trouble you too much
-
krig
not at all! I can’t promise anything (not much time right now), but if I get it working I’ll update the issue you created
-
willowispll
okay, thanks again!
-
krig
@willowispll hmm yeah unfortunately the tree-sitter grammar is too outdated to build in, but it *might* work as an extension.. I think what you could try is to clone the zed extension to a local directory, change extension.toml to point to the newer tree-sitter grammar and copy the queries/*.scm from that grammar into the languages/hare/ folder in the extension. The hare-lsp binary needs to be installed and in PATH already but it looks like it should be detected. If that still doesn’t work it’ll probably be a challenge to get it working :/
-
krig
oh and yeah then install the extension from that directory in gram
-
willowispll
okay! i will try, thanks
-
willowispll
is it possible to "steal" it from the other editor? like nvim: https://git.sr.ht/~sircmpwn/hare.vim
-
willowispll
sorry if its too hard or the question is too stupid lol
-
krig
yes, that could be possible for sure!
-
krig
ah, looks like that’s using vim native syntax highlighting and not tree-sitter. Unfortunately gram only supports tree-sitter for syntax highlightning.. one of the founders of zed is the creator of tree-sitter
-
willowispll
i can try to poke the person who made the original tree-sitter
-
willowispll
Ive sent an email!
-
krig
good luck! I should learn how to maintain tree-sitter grammars, just never gotten around to it