diff --git a/tooling/zed-rx/README.md b/tooling/zed-rx/README.md index 1cf8ebc4..e4c15ce0 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 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. 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"] + } +]