The Gram Code Editor - 2026-10-14


  1. mort

    https://upload.yax.im/upload/Val8Kddtue-xdlOU6PfaIoi9/Screenshot%202026-10-14%20at%2002.27.00.jpg

  2. 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. ↺

  3. 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? ✎

  4. 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? ✏

  5. 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

  6. mort

    I looked at rhai too (https://github.com/rhaiscript/rhai) but it smells a bit too AI for my taste

  7. 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

  8. mort

    You're probably right

  9. 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

  10. 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

  11. koru

    mlua is used in Yazi as plugin system and as I know do not require system Lua

  12. 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

  13. koru

    Nice

  14. mort

    I wonder how hard it would be to get most of nvim-lspconfig to work in gram..

  15. 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.

  16. ashleytg

    will gram plugins ever not require providing a repo link?

  17. 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”

  18. mort

    https://upload.yax.im/upload/zmMvsnRV1jS9w4KeoqTorPcm/Screenshot%202026-10-14%20at%2010.39.00.jpg

  19. koru

    mort, is that mlua?

  20. mort

    Yeah

  21. 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

  22. koru

    Can you do something or it's only `print` available?

  23. mort

    Well it has all of Lua but no interaction with Gram yet

  24. koru

    Why not LuaJIT? https://codeberg.org/xmort/gram/src/commit/e141ecfea83c94053861ccd49426564bbb6d0ddf/Cargo.toml#L221

  25. 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

  26. 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
  27. 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

  28. 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

  29. koru

    Why not just make built-in LSP support (like that does Helix)?

  30. koru

    Helix is awesome, btw!

  31. krig

    Yeah I want to change how tree-sitter grammars are compiled and loaded to be more like helix

  32. krig

    and then rewrite all the builtin languages to be extensions so we don’t need to bundle any grammars

  33. 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?

  34. 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

  35. 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"

  36. 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

  37. krig

    Helix just compiles with a C compiler. Zero safety 😅 benefit is much simpler requirements on the user environment

  38. krig

    I have thought about the possibility of using an embedded tcc compiler that is very restrictive on what the grammar code can do…

  39. 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

  40. 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

  41. krig

    same thing with LSPs… it’s insane to me that the editor now just downloads whatever the latest release is from github…

  42. mort

    yeah..

  43. 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

  44. 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.

  45. 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

  46. 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

  47. koru

    Offtop, but anyone saw Helix drama? https://github.com/helix-editor/helix/discussions/15408

  48. 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

  49. 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?

  50. koru

    Carrot, is your issue similar to https://codeberg.org/GramEditor/gram/issues/296#issuecomment-15115224 and https://codeberg.org/GramEditor/gram/issues/227?

  51. Carrot

    @karu no im sorry i forgot to have the extension be .tsx instead of .jsx, it works now

    ❤ 1
  52. Carrot

    wait im stupid, i thought that eslint was the reason why i dident have autocomplete in react

  53. Carrot

    idk what eslint does tbh

  54. koru

    Carrot, what you want to do?

  55. koru

    I mean trying to do.

  56. Carrot

    well eslint still doesent work, with the given error, but i dont know how important that is

  57. Carrot

    i guess il leave it ate that, since my problem is fixed

  58. 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…

  59. 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

  60. krig

    yeah set GRAM_STANDALONE=1, then it runs with a temporary database

  61. krig

    and should skip the bundle id check

  62. mort

    Oh nice!

  63. mort

    Wait that didn't seem to make a difference

  64. krig

    hm is that not it.. going from memory here

  65. krig

    sorry, GRAM_STATELESS

  66. mort

    Nice, that worked

  67. mort

    https://upload.yax.im/upload/essQOiLxZaMG1S7yXervKbCZ/Screenshot%202026-10-14%20at%2020.36.59.jpg

  68. 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

  69. krig

    hm yeah suspicious

  70. 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

  71. 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..

  72. mort

    https://upload.yax.im/upload/mFMx-sy1GMxm7piMJ6roPr6u/Screenshot%202026-10-14%20at%2021.43.47.jpg

  73. mort

    That .. is a functional extension for Lua written in Lua

  74. mort

    https://upload.yax.im/upload/PHqCTFDPSwrUsAelB2iSrjLz/Screenshot%202026-10-14%20at%2021.44.35.jpg

  75. mort

    Like, I can go to definition in the editor using that extension, no wasm involved

  76. mort

    The right API here is almost certainly not to have separate functions like this, still in the experimentation phase

  77. krig

    Oh wow, that's awesome! Great progress @mort

  78. krig

    Could even imagine converting the simple builtin language support to embedded lua extensions then...

  79. 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

  80. krig

    super cool, I'll take a look

  81. 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)

  82. mort

    I'll do some builds to compare both the binary size impact and the compile time impact of adding lua

  83. 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

  84. krig

    didn't measure compile time though

  85. 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

  86. krig

    ooh OK, the small binary size difference is because it's trying to dynamically link to lua.. and then crashes on startup

  87. 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"

  88. krig

    interesting though! that's a tiny size increase

  89. mort

    Ohhh yes it links against that for me as well

  90. krig

    ahh right

  91. krig

    ok makes sense!

  92. krig

    looks like adding the `vendored` feature flag should work.. will try

  93. mort

    Trying the same myself

  94. mort

    180.01MiB

  95. krig

    nice!

  96. mort

    So a bit over half a meg then. Not nothing but not a ton (considering it's a whole language runtime hehe)

  97. krig

    yeah if the goal is to eventually remove the Wasm extensions the end result will be huge savings anyway..

  98. mort

    4m 58s now with the vendor feature

  99. 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.

  100. krig

    Hi, and welcome!

  101. willowispll

    Ive been using zed for quite a while but gram feels so refreshing! And i also like the mascot(?)

  102. krig

    It’s the most important feature 😄

  103. willowispll

    If you need any help with testing or something like that im always ready!

  104. 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

  105. 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

  106. willowispll

    hm, interesting

  107. willowispll

    can u share pictures here?

  108. mort

    yeah

  109. 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

  110. willowispll

    XMPP question its my first time

  111. 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

  112. willowispll

    and honestly, its already impressive to me

  113. willowispll

    Its for gram-3.3.0

  114. 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

  115. willowispll

    or i can also ask the current nixpkgs maintainer for gram

  116. krig

    oh yeah I’ve done a lot of work since 3.3 to reduce the binary size

  117. willowispll

    yeah the comparison is amazing zed: NAR Size: 357.77 MiB | Closure Size: 1.45 GiB | Added Size: 1.45 GiB

  118. krig

    they keep adding stuff and I keep removing stuff :D

  119. mort

    How do you feel about the wasm-less numbers?

  120. willowispll

    at least you added the toad!

  121. willowispll

    im amazed, but i still miss only 1 feature, xd

  122. willowispll

    but everything else is just better

  123. mort

    What one feature?

  124. willowispll

    Build-in hare support

  125. willowispll

    At the end its a problem of my weird setup

  126. mort

    Oh, you use Hare? I've read about it and it seems interesting but I never tried it out

  127. 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

  128. mort

    Sounds like a cool project!

  129. 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

  130. 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..

  131. krig

    or some *BSD I guess, depending on what happens with Linux.. things are looking grim

  132. willowispll

    I wish i had more rust knowledge to pr myself but i have what i have sadly

  133. willowispll

    yeah makes sense

  134. krig

    is there an LSP for hare?

  135. willowispll

    https://sr.ht/~whynothugo/hare-lsp/ this is the up-to date one

  136. krig

    if there’s a tree-sitter grammar I should be able to add basic support at least

  137. 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>. ```

  138. krig

    it should be doable i feel like.. let me take a look at it

  139. willowispll

    ``` Tree sitter A tree sitter grammar for Hare is available here. https://git.sr.ht/~ecs/tree-sitter-hare ```

  140. krig

    Hm.. 2 years old, it might not have the API gram expects

  141. willowispll

    what zed uses?

  142. krig

    will give it a try though

  143. willowispll

    tysm! i hope i dont trouble you too much

  144. 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

  145. willowispll

    okay, thanks again!

  146. 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 :/

  147. krig

    oh and yeah then install the extension from that directory in gram

  148. willowispll

    okay! i will try, thanks

  149. willowispll

    is it possible to "steal" it from the other editor? like nvim: https://git.sr.ht/~sircmpwn/hare.vim

  150. willowispll

    sorry if its too hard or the question is too stupid lol

  151. krig

    yes, that could be possible for sure!

  152. 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

  153. willowispll

    i can try to poke the person who made the original tree-sitter

  154. willowispll

    Ive sent an email!

  155. krig

    good luck! I should learn how to maintain tree-sitter grammars, just never gotten around to it