Gleam-inspired typed configuration language (POC)
0

Configure Feed

Select the types of activity you want to include in your feed.

glint / editors / zed
4 folders 8 files
README.md

Glint for Zed#

Gleam-authored Zed extension for Glint: tree-sitter highlighting (via tree-sitter-gleam) and the glint language server.

Source of truth: src/zed_glint.gleam
Artifact: extension.wasm (Zed zed:extension component, API 0.7.0)

From the glint repo (uses the gleam wasm fork as a flake input):

cd /home/nandi/code/glint
# optional: use a local gleam checkout
# nix build .#zed-extension --override-input gleam path:../gleam

nix build .#zed-extension
# → ./result/{extension.toml,extension.wasm,languages/…}

nix run .#install-zed-extension -- ~/glint-zed-dev
# then Zed → Extensions → Install Dev Extension → ~/glint-zed-dev

nix develop sets GLEAM to the wasm-capable compiler for the cargo build driver in this directory.

Build#

Zed’s Install Dev Extension only knows how to run:

cargo build --target wasm32-wasip2

So this package includes a tiny cargo build driver that does not implement the extension. It only:

  1. Runs gleam export zed-extension (build.rs)
  2. Installs that component as the crate’s .wasm output (scripts/gleam-wasm-linker)

src/lib.rs is an empty compile stub required by cargo; its code is discarded.

Prerequisites#

# Glint LSP binary
cd /home/nandi/code/glint && nix build   # → result/bin/glint

# Wasm-capable Gleam (our fork)
# https://tangled.org/nandi.uk/gleam  — branch wasm
git clone https://tangled.org/nandi.uk/gleam
cd gleam && git checkout wasm
cargo build -p gleam
export GLEAM="$PWD/target/debug/gleam"

# Cargo target so `cargo build --target wasm32-wasip2` can run
rustup target add wasm32-wasip2

build.rs also auto-finds ../../gleam/target/debug/gleam when glint and gleam are siblings (e.g. under ~/code/).

Build the extension#

cd /home/nandi/code/glint/editors/zed
export GLEAM=/path/to/gleam/target/debug/gleam   # if not auto-found
cargo build --release --target wasm32-wasip2
# → target/wasm32-wasip2/release/zed_glint.wasm  (from Gleam)

Or call Gleam directly:

$GLEAM export zed-extension
# → extension.wasm

Install in Zed#

  1. Ensure GLEAM is set in the environment Zed inherits, or keep a sibling ~/code/gleam build at target/debug/gleam.

  2. Extensions → Install Dev Extension…

    /home/nandi/code/glint/editors/zed
    
  3. Open a *.glint file — the guest starts glint lsp.

LSP binary resolution#

  1. lsp.glint.binary in Zed settings
  2. glint on $PATH
  3. Fallback: /home/nandi/code/glint/result/bin/glint
{
  "lsp": {
    "glint": {
      "binary": {
        "path": "/home/nandi/code/glint/result/bin/glint",
        "arguments": ["lsp"]
      }
    }
  }
}

Layout#

Path Role
src/zed_glint.gleam Extension (Gleam)
build.rs Driver: gleam export zed-extension
scripts/gleam-wasm-linker Driver: cargo output = Gleam component
src/lib.rs Empty stub for cargo only
extension.toml Zed manifest (kind = "Rust" is required by Zed’s schema)
languages/glint/ Tree-sitter queries + language config
extension.wasm Built component

Grammar id is gleam (exports tree_sitter_gleam). Language name / path suffix stay Glint / *.glint.

Compiler docs: https://tangled.org/nandi.uk/gleam (docs/compiler/wasm-zed-extensions.md).