You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CodeMirror 6 language support for [JSONata](https://jsonata.org) expressions — syntax highlighting, error diagnostics, autocomplete, and hover documentation, powered by a 380 KB WASM module (145 KB gzipped).
4
-
5
-
## Features
6
-
7
-
-**Syntax highlighting** — Lezer grammar with full JSONata 2.x coverage (works without WASM)
8
-
-**Error diagnostics** — real-time squiggly underlines from the gnata parser
9
-
-**Autocomplete** — context-aware: `$` triggers function completions with signatures, `.` triggers field completions from your data schema
10
-
-**Hover documentation** — hover any `$function`, operator, keyword, or data field to see docs, signatures, and examples
3
+
CodeMirror 6 language support for [JSONata](https://jsonata.org) — syntax highlighting, error diagnostics, autocomplete, and hover documentation.
11
4
12
5
## Install
13
6
14
7
```bash
15
8
npm install @gnata-sqlite/codemirror
16
9
```
17
10
18
-
You also need the WASM files served from your app:
19
-
-`gnata-lsp.wasm` (380 KB, 145 KB gzipped)
20
-
-`lsp-wasm_exec.js` (TinyGo runtime)
11
+
Serve the WASM files from your app's public directory:
12
+
-`gnata-lsp.wasm`
13
+
-`lsp-wasm_exec.js`
14
+
15
+
If you're using `@gnata-sqlite/react`, the WASM files are already included — run `npx @gnata-sqlite/react` to copy them into place.
jsonataFull({ schema: schemaString }) // with static schema
61
-
jsonataFull({ schema: () =>getSchema() }) // with dynamic schema
56
+
jsonataFull({ schema })
57
+
// or pass a getter for dynamic schemas:
58
+
jsonataFull({ schema: () =>currentSchema })
62
59
```
63
60
64
-
The `schema` option enables field-aware autocomplete and hover. Pass a JSON string describing your data shape (see [Schema Format](#schema-format) below), or a getter function for dynamic schemas.
61
+
Type `Account.Order.`and it suggests `Product` with type info. The `@gnata-sqlite/react` package exports a `buildSchema()` helper that generates this from sample JSON data.
65
62
66
-
###Individual Extensions
63
+
## Individual Extensions
67
64
68
-
Use these for fine-grained control:
65
+
`jsonataFull()` bundles everything. For fine-grained control, use the individual extensions:
69
66
70
67
```ts
71
68
import {
72
69
jsonata, // syntax highlighting only (no WASM needed)
73
70
jsonataLint, // error diagnostics
74
71
jsonataCompletion, // autocomplete
75
72
jsonataHover, // hover tooltips
73
+
jsonataLanguage, // underlying language definition
76
74
} from"@gnata-sqlite/codemirror"
77
75
78
76
extensions: [
@@ -85,136 +83,33 @@ extensions: [
85
83
]
86
84
```
87
85
88
-
### `jsonata()`
89
-
90
-
Syntax highlighting only. Works without WASM — no `initWasm()` needed.
91
-
92
-
## Schema Format
93
-
94
-
The schema is a JSON string describing the shape of the input data. It enables field completions after `.` and type info on hover.
The WASM module contains the gnata parser and a catalog of 89 built-in JSONata functions with full documentation. It runs entirely in the browser — no server calls needed.
211
-
212
-
## Native LSP
213
-
214
-
The same Go code also builds as a native LSP server for VS Code / Neovim:
215
-
216
-
```bash
217
-
go build -o gnata-lsp ./editor/
218
-
```
113
+
## License
219
114
220
-
Supports `textDocument/didOpen`, `textDocument/didChange`, `textDocument/completion`, `textDocument/hover`, and diagnostics.
0 commit comments