Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tooling/zed-rx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Highlighting for `.rx` and `.d.rx` from a Tree-sitter grammar
([`../rx-language-server`](../rx-language-server)), TypeScript's hover, go to
definition, references, rename, completion and type errors, plus the
compiler's own diagnostics. ` ```rx ` and ` ```reactivescript ` blocks in
Markdown use the same language.
Markdown use the same language. Snippets (`source`, `sourceq`, `action`,
`component`, `app`, `effect`, `fn`, `for`, `if`) are in
`snippets/reactivescript.json`.

The extension installs `@reactivescript/language-server` from npm (and updates it
when a newer release exists; offline it keeps the installed copy) and runs it
Expand Down
1 change: 1 addition & 0 deletions tooling/zed-rx/extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ schema_version = 1
authors = ["Ryan Carniato"]
description = "ReactiveScript (.rx, .d.rx): highlighting, and TypeScript's types, hover, go to definition, completion and errors through the .rx language server."
repository = "https://github.com/solidjs/reactivescript"
snippets = "./snippets/reactivescript.json"

[language_servers.rx-language-server]
name = "ReactiveScript Language Server"
Expand Down
47 changes: 47 additions & 0 deletions tooling/zed-rx/snippets/reactivescript.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"source": {
"prefix": "source",
"body": "source ${1:name}: ${2:number} := ${3:0}",
"description": "State, written with :="
},
"source (question)": {
"prefix": "sourceq",
"body": "source ${1:user} = await ${2:fetchUser}(${3:id})",
"description": "State with a question, re-asked when its inputs change"
},
"action": {
"prefix": "action",
"body": ["action ${1:save}(${2}) {", "\t$0", "}"],
"description": "Action: writes and awaits"
},
"component": {
"prefix": "component",
"body": ["component ${1:Item}(props: { ${2:title}: ${3:string} }) {", "\t<${4:div}>$0</${4:div}>", "}"],
"description": "Component"
},
"export default component": {
"prefix": "app",
"body": ["export default component ${1:App}() {", "\t<${2:main}>$0</${2:main}>", "}"],
"description": "Entry module's default component"
},
"effect": {
"prefix": "effect",
"body": ["effect (${1:count}) {", "\t$0", "}"],
"description": "Runs after the listed values change; $0, $1 are their values"
},
"fn": {
"prefix": "fn",
"body": "fn ${1:area}(${2:w}: ${3:number}, ${4:h}: ${5:number}): ${6:number} => ${7:w * h}",
"description": "Pure function"
},
"for": {
"prefix": "for",
"body": ["{for ${1:it} in ${2:items} {", "\t$0", "}}"],
"description": "Markup loop"
},
"if": {
"prefix": "if",
"body": ["{if ${1:cond} {", "\t$0", "} else {", "\t$2", "}}"],
"description": "Conditional inside markup; in code, write if (c) { … }"
}
}
Loading