Skip to content

v0.2.0 — Custom expr functions & editor extensibility

Choose a tag to compare

@diogenesc diogenesc released this 22 May 02:35
· 3 commits to main since this release

Extensible Editor for Custom Expr Functions

Adds a Go library package pkg/wasmlib that allows users to register custom expr functions and rebuild their own WASM binary. The editor frontend dynamically loads function metadata from WASM for autocomplete, hover tooltips, and syntax highlighting.

Highlights

  • pkg/wasmlib: Reusable Go package. Call wasmlib.Register() + wasmlib.Serve() — no boilerplate.
  • Autocomplete for all 55 built-in plus custom functions (signatures, descriptions).
  • Hover tooltips showing function signatures and docs.
  • Dynamic function loading: WASM reports registered functions via exprFuncDefs() — JS merges them automatically.

Usage

package main

import "github.com/diogenesc/better-expr-editor/pkg/wasmlib"

func main() {
    wasmlib.Register("myFunc", myFuncImpl,
        new(func(int) bool),
    ).Signature("myFunc(x int) => bool").
      Detail("Checks something")

    wasmlib.Serve()
}

Build: GOOS=js GOARCH=wasm go build -o public/expr.wasm ./wasm