Skip to content

zed-rx: a Zed extension for .rx - #2

Draft
oddcelot wants to merge 8 commits into
mainfrom
zed-rx
Draft

oddcelot wants to merge 8 commits into
mainfrom
zed-rx

Conversation

@oddcelot

@oddcelot oddcelot commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Hi! This adds a Zed extension for .rx and .d.rx in tooling/zed-rx. It builds on the tree-sitter grammar from solidjs#88 and closes the gap the language server README mentions: "Zed needs an extension of its own; there isn't one yet".

What you get

  • Language server: the same one VS Code runs, so hover, go to definition, references, rename, completion, type errors and the compiler's diagnostics all work the same.
  • No setup: the extension installs @reactivescript/language-server from npm and keeps it updated. The compiler ships in it as WebAssembly, so there is nothing to build per platform.
  • Highlighting: sources, equations and writes look different on screen.
  • Outline: components, fns, actions, sources, equations, contexts, errors and types.
  • Editing: indentation, bracket matching, JSX tag auto-close and Vim text objects.
  • Embedded languages: <style> blocks are CSS, and rx code fences in Markdown are highlighted.

Highlighting in examples/todos.rx

Code Capture Reads as
source failures, todos[i].done := … @variable.special state
live = …, shown = … @constant derived
:= @keyword.operator a write

Markup inside exported components and control blocks is highlighted too. That is the case solidjs#86 fixed for the TextMate grammar.

image file-2ca82ec93d35a8a96cf1605f3a235e3a

Settings

All optional, under lsp.rx-language-server in Zed's settings.json. They mirror the three VS Code settings.

Setting What it does Default
binary.path Run another server, such as one from a checkout The npm package
settings.rxc.path Use an rxc binary in place of the WebAssembly build The bundled build
settings.typescript.tsdk TypeScript's lib folder The project's node_modules/typescript/lib, else the server's own
Example
{
  "lsp": {
    "rx-language-server": {
      "binary": { "path": "/path/to/reactivescript/tooling/rx-language-server/bin/server.js" },
      "settings": {
        "rxc": { "path": "/path/to/reactivescript/compiler/target/release/rxc" },
        "typescript": { "tsdk": "/path/to/project/node_modules/typescript/lib" }
      }
    }
  }
}

Notes for review

Testing

  • cargo build --release --target wasm32-wasip2, cargo clippy and cargo fmt --check are clean
  • All seven query files run through tree-sitter query on four example files with no errors
  • The published npm package (0.3.1) has bin/server.js where the extension starts it
  • Installed as a dev extension in Zed and checked by hand on examples/shop and examples/todos.rx

Not included

  • Snippets
  • Tasks for rx-tsc
  • Publishing to Zed's extension registry, which needs a PR to zed-industries/extensions

@oddcelot
oddcelot changed the base branch from tree-sitter-rx to main November 20, 2026 23:55
Every comment was handed to the JSDoc grammar, so a // line came out as
JSDoc description text, and its words lost the comment colour up to the
first comma or full stop.
…th as Zed runs it

Zed starts lsp.rx-language-server.binary.path itself and never asks the
extension for a command, so the branch that read it was dead: no --stdio,
no Node for a .js file, no RXC. The README now shows the settings that work.

A failed npm install no longer stops a server that is already on disk, and
an install whose bin/server.js is missing is installed again.
…ns, ' closes

The type_arguments and type_parameters patterns sat before the operator
list, which also has < and >, and the later pattern wins.
With the language taken from the tag's capture and injection.combined,
Zed's JSX tag auto-close did nothing anywhere in a .rx file, even where
no template matched. One pattern per tag, the language named, as in
Zed's own TSX injections, brings it back; css`…` still highlights.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant