From e8da30fc4ea9e8db8cbb1543a54d6077d804aa66 Mon Sep 17 00:00:00 2001 From: Stefan Kopco Date: Sun, 22 Nov 2026 11:19:37 +0100 Subject: [PATCH 1/2] zed-rx: semantic token rules for the server's `source` and `equation` With semantic_tokens on, Zed draws the server's tokens over the grammar's colours, and TypeScript's tokens call a source and an equation both a read-only variable. The server marks them with a modifier each; semantic_token_rules.json maps those to the styles highlights.scm uses for their declarations, variable.special and constant. --- tooling/zed-rx/README.md | 9 +++++++++ .../reactivescript/semantic_token_rules.json | 12 ++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tooling/zed-rx/languages/reactivescript/semantic_token_rules.json diff --git a/tooling/zed-rx/README.md b/tooling/zed-rx/README.md index 1cf8ebc4..84d5b60c 100644 --- a/tooling/zed-rx/README.md +++ b/tooling/zed-rx/README.md @@ -113,3 +113,12 @@ default: ```json { "languages": { "ReactiveScript": { "semantic_tokens": "combined" } } } ``` + +Zed draws a semantic token over the grammar's colour. TypeScript calls a source +and an equation both a read-only variable, so the server marks them `source` +and `equation`, and `languages/reactivescript/semantic_token_rules.json` gives +those the colours `highlights.scm` gives their declarations: a source is +`variable.special`, an equation `constant`. With them on, every read of a +source or an equation has its colour, not only its declaration and its writes. +A server that does not mark them (0.3.1 and earlier) shows both as TypeScript's +read-only variable. diff --git a/tooling/zed-rx/languages/reactivescript/semantic_token_rules.json b/tooling/zed-rx/languages/reactivescript/semantic_token_rules.json new file mode 100644 index 00000000..2282f664 --- /dev/null +++ b/tooling/zed-rx/languages/reactivescript/semantic_token_rules.json @@ -0,0 +1,12 @@ +[ + { + "token_type": "variable", + "token_modifiers": ["source"], + "style": ["variable.special"] + }, + { + "token_type": "variable", + "token_modifiers": ["equation"], + "style": ["constant"] + } +] From d3b0c53b6eca788bd0e2ec5e18f63e56f52ab319 Mon Sep 17 00:00:00 2001 From: Stefan Kopco Date: Sun, 22 Nov 2026 13:14:06 +0100 Subject: [PATCH 2/2] zed-rx: the README says which server marks sources and equations, and how both look without it --- tooling/zed-rx/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tooling/zed-rx/README.md b/tooling/zed-rx/README.md index 84d5b60c..e4c15ce0 100644 --- a/tooling/zed-rx/README.md +++ b/tooling/zed-rx/README.md @@ -119,6 +119,6 @@ and an equation both a read-only variable, so the server marks them `source` and `equation`, and `languages/reactivescript/semantic_token_rules.json` gives those the colours `highlights.scm` gives their declarations: a source is `variable.special`, an equation `constant`. With them on, every read of a -source or an equation has its colour, not only its declaration and its writes. -A server that does not mark them (0.3.1 and earlier) shows both as TypeScript's -read-only variable. +source or an equation has its colour, not only its declaration (and a source's +writes). The server on npm (0.3.1) does not mark them yet: with it, both show +as a plain `variable`, declarations too.