Repository navigation
Conversation
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.
…*/ is not a doc comment Object and array patterns of a parameter are parameters, on optional parameters too. The root of a write or guess was found three members deep; a query cannot recurse, so it is four now and the cap is written down. /**/ and a /*** banner were doc comments in highlights.scm but not JSDoc in injections.scm; both use the same test now.
…he pinned grammar No workflow built tooling/zed-rx or ran its queries. A query that names a node the grammar does not have stops Zed loading the language, so check-queries.sh runs every query over examples/*.rx on the grammar extension.toml pins, fetched from the repository named there when the checkout does not have it. zed.yml runs it after fmt, clippy and the wasm32-wasip2 build. The README says how to run the same checks and where to look in Zed.
… does not warn about parser directories
|
What I'd do after this, roughly in order:
One more: a grammar change doesn't reach Zed until the |
|
Getting this into Zed's registry, going by their publishing guide: The registry is the git clone https://github.com/zed-industries/extensions
cd extensions
git submodule add https://github.com/solidjs/reactivescript.git extensions/reactivescript
git -C extensions/reactivescript checkout <commit on main with tooling/zed-rx>[reactivescript]
submodule = "extensions/reactivescript"
path = "tooling/zed-rx"
version = "0.1.0"Then Their requirements, which I think this meets:
They also ask that the exact commit being submitted is tested by hand, and they close PRs whose feedback isn't answered within 3 weeks. Each update is another PR there that moves the submodule and bumps The submodule is the whole repo, so their CI clones |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Hi! This adds a Zed extension for
.rxand.d.rxintooling/zed-rx. It builds on the tree-sitter grammar from #88 and fills the gap the language server README mentions: "Zed needs an extension of its own; there isn't one yet".The extension starts the same language server VS Code runs, so hover, go to definition, references, rename, completion, type errors and the compiler's diagnostics behave the same. It installs
@reactivescript/language-serverfrom npm and updates it when there's a newer release. If it's offline or the update fails, it keeps the copy it already has. The compiler comes inside that package as WebAssembly, so there's nothing to build per platform.On the tree-sitter side there are queries for:
fns, actions, sources, equations, contexts, errors and types<style>as CSS,/** */as JSDoc, regex literals, andcss,html,sql,graphql/gqlandstyledtemplates.rxfences in Markdown are highlighted too.Trying it
Run zed: install dev extension and pick
tooling/zed-rx. Zed builds it with Rust from rustup.Note
Like the VS Code extension, the server expects a
tsconfig.jsonwith"jsx": "preserve"and"jsxImportSource": "@solidjs/web", and@solidjs/webinnode_modules.Highlighting
examples/todo.rxsource todos,nextId := nextId + 1@variable.specialshown = …,remaining = …@constant:=@keyword.operatorMarkup inside exported components and control blocks is highlighted too, which is what #86 fixed for the TextMate grammar.
Settings
All optional, under
lsp.rx-language-serverin Zed'ssettings.json. They're the same three settings the VS Code extension has.binarysettings.rxc.pathrxcbinary instead of the WebAssembly buildsettings.typescript.tsdklibfoldernode_modules/typescript/lib, else the server's ownExample
{ "lsp": { "rx-language-server": { "settings": { "rxc": { "path": "/path/to/reactivescript/compiler/target/release/rxc" }, "typescript": { "tsdk": "/path/to/project/node_modules/typescript/lib" } } } } }With
binary.pathset, Zed runs that command itself and never asks the extension. It doesn't add--stdio, doesn't run a.jsfile with its Node, and doesn't readsettings.rxc.path, so all three have to go inbinary:A server from a checkout
{ "lsp": { "rx-language-server": { "binary": { "path": "node", "arguments": ["/path/to/reactivescript/tooling/rx-language-server/bin/server.js", "--stdio"], "env": { "RXC": "/path/to/reactivescript/compiler/target/release/rxc" } } } } }Zed has semantic tokens off by default.
"languages": { "ReactiveScript": { "semantic_tokens": "combined" } }turns the server's on.Notes for review
The queries are MIT. I wrote them from the grammar's own queries and from tree-sitter-javascript's and tree-sitter-typescript's. Zed's built-in TSX queries are GPL, so none of their text is in here.
revinextension.tomlpins the grammar atb470614, the squash commit of #88. A grammar change only reaches Zed once that line is bumped.injections.scmhas one pattern per template tag with the language written out, the way Zed's TSX injections do it. Taking the language from the tag's capture withinjection.combinedwould be shorter, but it broke JSX tag auto-close everywhere in a.rxfile.TypeScript is only looked up at the worktree root. A project that hoists
node_modulesto a parent folder has to setsettings.typescript.tsdk.The server README also loses "Neovim has no
.rxgrammar yet", which stopped being true with #88.Testing
cargo build --release --target wasm32-wasip2,cargo clippyandcargo fmt --checkpass./check-queries.shruns all seven query files throughtree-sitter queryon the examples, on the grammarextension.tomlpinszedworkflow runs the cargo checks andcheck-queries.shin CIbin/server.jswhere the extension starts itexamples/shopandexamples/todos.rxNot included
rx-tscsourceandequationsemantic tokenszed-industries/extensions. Until then it's a dev extension.