@fossil-lang/wasm 0.3.0-alpha.3 → 0.3.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,24 @@
6
6
  *
7
7
  * `Copy + Clone + Eq + Hash` so it can be a `HashMap` key on the Rust
8
8
  * side; `#[wasm_bindgen]` so JS can pass it back across the boundary.
9
+ *
10
+ * # Every exported method takes `&FileHandle`, and it has to
11
+ *
12
+ * wasm-bindgen CONSUMES an exported struct passed by value: the generated glue
13
+ * calls `__destroy_into_raw()` on the JS wrapper, which nulls its pointer. A
14
+ * handle passed by value is therefore good for exactly one call, and the second
15
+ * throws *"null pointer passed to rust"* — from inside a method that has nothing
16
+ * wrong with it, naming no handle and no file.
17
+ *
18
+ * `Copy` does not save it. The derive is a Rust-side property; nothing about it
19
+ * reaches the JS boundary, where this is a class holding a pointer like any
20
+ * other. The three methods a host calls repeatedly with one handle
21
+ * (`update_file`, `close_file`, `diagnostics_for`) take `&FileHandle` so
22
+ * wasm-bindgen borrows instead, and the handle stays live across the whole
23
+ * lifetime `open_file`'s doc comment promises.
24
+ *
25
+ * This was reachable from the FIRST loop an editor runs: `updateFile(h, text)` on
26
+ * every check, with the handle `openFile` returned once.
9
27
  */
10
28
  export class FileHandle {
11
29
  static __wrap(ptr) {
@@ -28,12 +46,37 @@ export class FileHandle {
28
46
  if (Symbol.dispose) FileHandle.prototype[Symbol.dispose] = FileHandle.prototype.free;
29
47
 
30
48
  /**
31
- * JS-facing handle for the Fossil compiler running inside a WASM module.
49
+ * The JS-facing workspace — `FossilPlayground` on the JS side, and a
50
+ * `RefCell` around the Rust one.
51
+ *
52
+ * # Why the interior `RefCell`, and it is not a style choice
53
+ *
54
+ * `wasm-bindgen` wraps every exported struct in its own `WasmRefCell`. A
55
+ * method taking `&mut self` borrows that cell EXCLUSIVELY for the call, and a
56
+ * failed borrow does not return — it panics, with
57
+ * *"recursive use of an object detected which would lead to unsafe aliasing in
58
+ * rust"*. On `wasm32-unknown-unknown` a panic is an abort: the trap unwinds
59
+ * nothing, so the borrow flag it was holding is never cleared, and **every
60
+ * later call on that object fails the same way for the life of the module.**
61
+ * One bad call poisons the workspace permanently.
32
62
  *
33
- * One instance owns one [`WasmDb`] (Salsa store + injected [`WasmSystem`]
34
- * + `Arc<OutputDescriptorKind>`). Hosts construct a single playground per
35
- * browser tab / Node process and reuse it across all method calls to
36
- * amortise the Salsa interning + memoisation overhead.
63
+ * That is a real defect and it was reachable from correct host code:
64
+ * `apps/playground` reproduced it by typing sixteen characters faster than its
65
+ * debounce, and the app carried a `busy` flag and a 120 ms coalesce to stay
66
+ * out of it. A mitigation a host has to remember is not a fix — and an editor
67
+ * is precisely the workload that forgets.
68
+ *
69
+ * So no exported method takes `&mut self`. Every one takes `&self`, which
70
+ * wasm-bindgen borrows SHARED — shared borrows nest, so re-entry cannot fail
71
+ * there — and the mutation goes through this `RefCell` with
72
+ * `try_borrow_mut`. Genuine re-entry (a JS callback that calls back in while a
73
+ * call is live) now returns a catchable `Error` naming what happened, and
74
+ * **the workspace is still usable afterwards**, because a returned `Err` drops
75
+ * its guard where a panic did not.
76
+ *
77
+ * The Rust-side [`FossilPlayground`] keeps its `&mut self` signatures
78
+ * untouched: `lsp_worker` already owns it inside an `Rc<RefCell<…>>`, and the
79
+ * native tests drive it directly. Only the JS boundary changed.
37
80
  */
38
81
  export class FossilPlayground {
39
82
  __destroy_into_raw() {
@@ -47,20 +90,27 @@ export class FossilPlayground {
47
90
  wasm.__wbg_fossilplayground_free(ptr, 0);
48
91
  }
49
92
  /**
50
- * Run `parse → def_map → typecheck_mapping` across every open file and
51
- * return a flat JS array of `{ uri, range, severity, message }` rows
52
- * keyed by file URI. The LSP Worker (07-03) republishes these grouped
53
- * by URI as `textDocument/publishDiagnostics` notifications.
93
+ * Every open **program**'s diagnostics as a flat JS array of
94
+ * `{ uri, range, severity, message }` rows keyed by file URI — the
95
+ * playground's panel view. It is NOT what the LSP Worker publishes; see
96
+ * [`CheckRow`], and `lsp_worker::publish_diagnostics` for the wire.
97
+ *
98
+ * A buffer the installed provider catalogue claims — the `.shex` the
99
+ * playground had to open to give the compiler a document, a `.csv`, a
100
+ * `.parquet` — is an INPUT and is not parsed as fossil.
101
+ * [`fossil_ide::diagnostics()`] is where that is said and measured, for both
102
+ * hosts.
54
103
  *
55
104
  * `range` is the UTF-16 LSP range (via `fossil_ide::LineIndex` — the
56
- * rust-analyzer model from 06-05). `severity` is the LSP integer
57
- * constant (1 = error, 2 = warning, 3 = info). `message` carries any
58
- * `suggestion_source` as a `\nhelp: ...` suffix (mirroring `fossil-lsp`
59
- * `to_lsp_diagnostic` in 06-09).
105
+ * rust-analyzer model). `severity` is the LSP integer constant
106
+ * (1 = error, 2 = warning, 3 = info). `message` carries any
107
+ * `suggestion_source` as a `\nhelp: ...` suffix. All three come from
108
+ * [`fossil_ide::lsp_diagnostic`], the rendering an editor is shown.
60
109
  *
61
110
  * # Errors
62
111
  *
63
- * Returns a JS error only if the result fails to serialize to `JsValue`.
112
+ * Returns a JS error if the workspace is busy, or if the result fails to
113
+ * serialize to `JsValue`.
64
114
  * @returns {any}
65
115
  */
66
116
  check() {
@@ -71,68 +121,119 @@ export class FossilPlayground {
71
121
  return takeFromExternrefTable0(ret[0]);
72
122
  }
73
123
  /**
74
- * Return the stdlib classification manifest as a JS array of
75
- * `{ name, wasm_class }` objects (STDL-07).
124
+ * Close a file in the workspace. Idempotent in spirit but strict in
125
+ * signal: closing an unknown / already-closed handle is an error so
126
+ * JS-side bugs surface loudly (mirrors `ty_wasm`).
76
127
  *
77
- * `wasm_class` is the string `"pure_sql"` or `"native_udf_only"`. The
78
- * playground reads this once at startup to render `native_udf_only`
79
- * functions as disabled with a "native-only — unavailable in the browser"
80
- * tooltip (SC#1 playground half). `DuckDB`-WASM cannot register the Rust
81
- * UDFs those functions need (Pitfall 3), so the classification is the
82
- * authority on what is runnable in-browser.
128
+ * # Errors
83
129
  *
84
- * This is pure read-only data projected from the `&'static`-ready
85
- * `fossil_registry::FunctionRegistry` — no `DuckDB`, no native UDF code,
86
- * WASM-clean.
130
+ * Returns a JS error if `handle` was never opened or was already closed,
131
+ * or if the workspace is busy.
132
+ * @param {FileHandle} handle
133
+ */
134
+ close_file(handle) {
135
+ _assertClass(handle, FileHandle);
136
+ const ret = wasm.fossilplayground_close_file(this.__wbg_ptr, handle.__wbg_ptr);
137
+ if (ret[1]) {
138
+ throw takeFromExternrefTable0(ret[0]);
139
+ }
140
+ }
141
+ /**
142
+ * The completion candidates at a position: `{ label, kind, detail }` rows,
143
+ * already narrowed by the receiver — `str.` offers string members and no
144
+ * reader, a property key position offers the target shape's predicates and
145
+ * no catalogue row.
146
+ *
147
+ * `kind` is the LSP `CompletionItemKind` **by name** (`"function"`,
148
+ * `"field"`). See [`ide::CompletionRow`] for why a number does not cross
149
+ * this boundary.
87
150
  *
88
151
  * # Errors
89
152
  *
90
- * Returns a JS error only if the manifest fails to serialize to `JsValue`.
153
+ * Returns a JS error if the workspace is busy, or if the result fails to
154
+ * serialize to `JsValue`. An unknown handle is an empty array.
155
+ * @param {FileHandle} handle
156
+ * @param {number} line
157
+ * @param {number} character
91
158
  * @returns {any}
92
159
  */
93
- classification() {
94
- const ret = wasm.fossilplayground_classification(this.__wbg_ptr);
160
+ completions(handle, line, character) {
161
+ _assertClass(handle, FileHandle);
162
+ const ret = wasm.fossilplayground_completions(this.__wbg_ptr, handle.__wbg_ptr, line, character);
95
163
  if (ret[2]) {
96
164
  throw takeFromExternrefTable0(ret[1]);
97
165
  }
98
166
  return takeFromExternrefTable0(ret[0]);
99
167
  }
100
168
  /**
101
- * Close a file in the workspace. Idempotent in spirit but strict in
102
- * signal: closing an unknown / already-closed handle is an error so
103
- * JS-side bugs surface loudly (mirrors `ty_wasm`).
169
+ * Per-file diagnostic drain: `check()` returns the workspace-wide flat
170
+ * array, this returns one file's rows, so a host can refresh one buffer's
171
+ * panel without partitioning the workspace array on the JS side. It is NOT
172
+ * what the LSP Worker publishes — that is
173
+ * [`fossil_ide::lsp_diagnostics`], through `lsp_worker::publish_diagnostics`.
104
174
  *
105
175
  * # Errors
106
176
  *
107
- * Returns a JS error if `handle` was never opened or was already closed.
177
+ * Returns a JS error if `handle` is unknown, if the workspace is busy, or
178
+ * if serialization fails.
108
179
  * @param {FileHandle} handle
180
+ * @returns {any}
109
181
  */
110
- close_file(handle) {
182
+ diagnostics_for(handle) {
111
183
  _assertClass(handle, FileHandle);
112
- var ptr0 = handle.__destroy_into_raw();
113
- const ret = wasm.fossilplayground_close_file(this.__wbg_ptr, ptr0);
114
- if (ret[1]) {
115
- throw takeFromExternrefTable0(ret[0]);
184
+ const ret = wasm.fossilplayground_diagnostics_for(this.__wbg_ptr, handle.__wbg_ptr);
185
+ if (ret[2]) {
186
+ throw takeFromExternrefTable0(ret[1]);
116
187
  }
188
+ return takeFromExternrefTable0(ret[0]);
117
189
  }
118
190
  /**
119
- * Per-file diagnostic drain — the B3 follow-up accessor the LSP Worker
120
- * (07-03) consumes for its per-file `publishDiagnostics` notifications.
121
- * `check()` returns the workspace-wide flat array; `diagnostics_for`
122
- * returns just one file's rows so 07-03 can dispatch one notification
123
- * per affected URI without partitioning the workspace array on the JS
124
- * side.
191
+ * Where the name under the cursor is defined: `{ uri, range }` rows, empty
192
+ * when nothing there has a definition.
193
+ *
194
+ * `uri` is the key the host opened the buffer under, verbatim — and two of
195
+ * the three positions goto-def recognises resolve into the shape document,
196
+ * so a host with one pane has to read it before moving a cursor.
125
197
  *
126
198
  * # Errors
127
199
  *
128
- * Returns a JS error if `handle` is unknown, or if serialization fails.
200
+ * Returns a JS error if the workspace is busy, or if the result fails to
201
+ * serialize to `JsValue`.
129
202
  * @param {FileHandle} handle
203
+ * @param {number} line
204
+ * @param {number} character
130
205
  * @returns {any}
131
206
  */
132
- diagnostics_for(handle) {
207
+ gotoDefinition(handle, line, character) {
208
+ _assertClass(handle, FileHandle);
209
+ const ret = wasm.fossilplayground_gotoDefinition(this.__wbg_ptr, handle.__wbg_ptr, line, character);
210
+ if (ret[2]) {
211
+ throw takeFromExternrefTable0(ret[1]);
212
+ }
213
+ return takeFromExternrefTable0(ret[0]);
214
+ }
215
+ /**
216
+ * What is under the cursor: `{ markdown, range }`, or `null` when the
217
+ * cursor is on whitespace, on an expression the checker inferred no type
218
+ * for, or outside any mapping.
219
+ *
220
+ * `line` / `character` are LSP — zero-based, and `character` in UTF-16
221
+ * code units, which is what a JS host counts in anyway. The `range` comes
222
+ * back in the same units.
223
+ *
224
+ * # Errors
225
+ *
226
+ * Returns a JS error if the workspace is busy, or if the result fails to
227
+ * serialize to `JsValue`. An unknown handle is `null`, not an error —
228
+ * see [`FossilPlayground::hover_row`].
229
+ * @param {FileHandle} handle
230
+ * @param {number} line
231
+ * @param {number} character
232
+ * @returns {any}
233
+ */
234
+ hover(handle, line, character) {
133
235
  _assertClass(handle, FileHandle);
134
- var ptr0 = handle.__destroy_into_raw();
135
- const ret = wasm.fossilplayground_diagnostics_for(this.__wbg_ptr, ptr0);
236
+ const ret = wasm.fossilplayground_hover(this.__wbg_ptr, handle.__wbg_ptr, line, character);
136
237
  if (ret[2]) {
137
238
  throw takeFromExternrefTable0(ret[1]);
138
239
  }
@@ -141,9 +242,9 @@ export class FossilPlayground {
141
242
  /**
142
243
  * Construct a new playground.
143
244
  *
144
- * Installs `console_error_panic_hook` (idempotent — RESEARCH.md
145
- * Don't-Hand-Roll #8) so any panic inside compiler-core surfaces as a
146
- * `console.error` stack trace in the host (browser `DevTools` or Node).
245
+ * Installs `console_error_panic_hook` (idempotent) so any panic inside
246
+ * compiler-core surfaces as a `console.error` stack trace in the host
247
+ * (browser `DevTools` or Node).
147
248
  */
148
249
  constructor() {
149
250
  const ret = wasm.fossilplayground_new();
@@ -153,18 +254,16 @@ export class FossilPlayground {
153
254
  }
154
255
  /**
155
256
  * Open a file in the workspace. Returns a [`FileHandle`] the JS side
156
- * keys subsequent `update_file` / `close_file` / `compile_file` calls
157
- * on. `path` is the URI / virtual path the diagnostics carry back to
158
- * the LSP client.
257
+ * keys subsequent `update_file` / `close_file` calls on. `path` is the
258
+ * URI / virtual path the diagnostics carry back to the LSP client.
159
259
  *
160
260
  * Mirrors `ty_wasm::Workspace::open_file` (Astral). Interns a fresh
161
261
  * [`fossil_base::SourceFile`] under the current Salsa revision.
162
262
  *
163
263
  * # Errors
164
264
  *
165
- * Returns a JS error only if the internal counter is exhausted
166
- * (`u32::MAX` files — would require a runaway loop in JS, not a normal
167
- * failure mode).
265
+ * Returns a JS error if the workspace is already inside another call —
266
+ * see the type-level note on [`WasmPlayground`].
168
267
  * @param {string} path
169
268
  * @param {string} contents
170
269
  * @returns {FileHandle}
@@ -182,42 +281,19 @@ export class FossilPlayground {
182
281
  }
183
282
  /**
184
283
  * Register an [`fossil_descriptors_input::InferredDescriptor`] for a
185
- * source binding name BEFORE invoking [`Self::compile`] /
186
- * [`Self::compile_file`]. The Rust compiler reads from this registration
187
- * during forward type propagation (Phase 3 CORE-05 rewired in plan
188
- * 13-02).
189
- *
190
- * `descriptor_json` is the JSON serialisation of `InferredDescriptor`;
191
- * the canonical shape is exposed in `packages/wasm/src/index.ts` as
192
- * `InferredDescriptorJson`:
193
- *
194
- * ```json
195
- * {
196
- * "source_name": "users",
197
- * "columns": [
198
- * { "name": "id", "primitive": "Integer" },
199
- * { "name": "name", "primitive": "String" }
200
- * ],
201
- * "content_hash": ""
202
- * }
203
- * ```
284
+ * source binding name BEFORE invoking `check`. The Rust compiler reads
285
+ * from this registration during forward type propagation — the browser has
286
+ * no filesystem to introspect a CSV from, so the column types must arrive
287
+ * from the host.
204
288
  *
205
- * Called by the browser-side playground orchestration AFTER running
206
- * DuckDB-WASM `DESCRIBE read_csv_auto('<resolved-url>')` and BEFORE
207
- * invoking `compile()` / `compile_file()`. Keyed by source-binding
208
- * name (`"users"` for `users := io.csv("...")`), NOT by URL.
209
- *
210
- * Idempotent: re-registering with the same `source_name` OVERWRITES the
211
- * previous entry — intentional, since the host may re-introspect when
212
- * file content changes.
289
+ * Registering the same URI twice REPLACES the previous descriptor
290
+ * — intentional, since the host re-introspects when the source changes.
213
291
  *
214
292
  * # Errors
215
293
  *
216
294
  * - Malformed JSON / missing required fields → JS `Error` with the
217
295
  * underlying `serde_json` message.
218
- *
219
- * Implementation: thin shim over the pure-Rust
220
- * [`Self::register_inferred_descriptor_native`] helper.
296
+ * - The workspace is busy.
221
297
  * @param {string} descriptor_json
222
298
  */
223
299
  registerInferredDescriptor(descriptor_json) {
@@ -228,37 +304,10 @@ export class FossilPlayground {
228
304
  throw takeFromExternrefTable0(ret[0]);
229
305
  }
230
306
  }
231
- /**
232
- * Install a user-supplied `ShEx` schema as the active output descriptor.
233
- * On parse failure the previously-installed descriptor is RETAINED (no
234
- * half-applied state — a broken schema must never wedge the editor;
235
- * same contract as `fossil-lsp`'s `load_sibling_shex` in 06-09).
236
- *
237
- * The schema is parsed via
238
- * [`fossil_descriptors_output::ShExDescriptor::from_reader`] (no
239
- * network access — Pitfall 1) and wrapped in
240
- * [`OutputDescriptorKind::ShEx`]. The resulting `Arc` is swapped into
241
- * the [`WasmDb`]'s descriptor slot atomically; future `fossil-ide`
242
- * feature calls (hover, completion) reading
243
- * [`HirDb::output_descriptor_kind`] see the new schema.
244
- *
245
- * # Errors
246
- *
247
- * Returns a JS error if the text is not a parseable `ShEx` schema.
248
- * @param {string} text
249
- */
250
- set_target_shex(text) {
251
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
252
- const len0 = WASM_VECTOR_LEN;
253
- const ret = wasm.fossilplayground_set_target_shex(this.__wbg_ptr, ptr0, len0);
254
- if (ret[1]) {
255
- throw takeFromExternrefTable0(ret[0]);
256
- }
257
- }
258
307
  /**
259
308
  * Apply an edit to an open file. Mutates the SAME `SourceFile` via the
260
309
  * Salsa [`salsa::Setter`] (`set_text`) — this BUMPS THE REVISION, the
261
- * real cancellation trigger (ADR-0022): any in-flight analysis from the
310
+ * real cancellation trigger: any in-flight analysis from the
262
311
  * previous keystroke observes the new revision at its next cooperative
263
312
  * checkpoint. NO new `SourceFile` is interned — the Salsa input
264
313
  * identity stays stable across the file's lifetime, so memoised
@@ -267,16 +316,18 @@ export class FossilPlayground {
267
316
  *
268
317
  * # Errors
269
318
  *
270
- * Returns a JS error if `handle` was never opened or was already closed.
319
+ * Returns a JS error if `handle` was never opened or was already closed,
320
+ * or if the workspace is already inside another call — see the type-level
321
+ * note on [`WasmPlayground`]. **Neither leaves the workspace unusable**,
322
+ * which is the whole reason this method takes `&self`.
271
323
  * @param {FileHandle} handle
272
324
  * @param {string} contents
273
325
  */
274
326
  update_file(handle, contents) {
275
327
  _assertClass(handle, FileHandle);
276
- var ptr0 = handle.__destroy_into_raw();
277
- const ptr1 = passStringToWasm0(contents, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
278
- const len1 = WASM_VECTOR_LEN;
279
- const ret = wasm.fossilplayground_update_file(this.__wbg_ptr, ptr0, ptr1, len1);
328
+ const ptr0 = passStringToWasm0(contents, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
329
+ const len0 = WASM_VECTOR_LEN;
330
+ const ret = wasm.fossilplayground_update_file(this.__wbg_ptr, handle.__wbg_ptr, ptr0, len0);
280
331
  if (ret[1]) {
281
332
  throw takeFromExternrefTable0(ret[0]);
282
333
  }
@@ -285,9 +336,10 @@ export class FossilPlayground {
285
336
  if (Symbol.dispose) FossilPlayground.prototype[Symbol.dispose] = FossilPlayground.prototype.free;
286
337
 
287
338
  /**
288
- * The data-source providers fossil supports (`io.csv`, `io.rdf`, …) as a JS
289
- * array of `{ name, extensions, kind }`. Pure projection of the stdlib source
290
- * registry — no parsing, no db.
339
+ * The providers this host installs (`io.csv`, `io.rdf`, `io.shex`, …) as a JS
340
+ * array of `{ name, extensions, kind }`. Pure projection of the provider
341
+ * registry — no parsing, no db. `kind` is read off each row's capabilities, so
342
+ * the two shape-document rows come back as `Schema`.
291
343
  *
292
344
  * # Errors
293
345
  * Returns a JS error only if the result fails to serialize to `JsValue`.
@@ -324,15 +376,14 @@ export function refs(program) {
324
376
  }
325
377
 
326
378
  /**
327
- * `JS`-facing re-export of the Phase-6 06-07 semantic-token legend.
379
+ * `JS`-facing re-export of the semantic-token legend.
328
380
  *
329
381
  * Returns `{ tokenTypes: string[], tokenModifiers: string[] }` — the exact
330
- * LSP `SemanticTokensLegend` shape. `CodeMirror` (plan 08-08 +
331
- * `packages/codemirror-fossil/src/tags.ts`) uses this to translate
332
- * LSP `semanticTokens/full` response indices into highlight tag names.
382
+ * LSP `SemanticTokensLegend` shape, which is what turns the indices in a
383
+ * `semanticTokens/full` response into names a host can style.
333
384
  *
334
- * Delegates to [`fossil_ide::semantic_legend`] (the 06-07 authoritative
335
- * definition) — NO duplicate legend definition lives here.
385
+ * Delegates to [`fossil_ide::semantic_legend`], the one definition — a second
386
+ * legend here would desynchronise the indices the native LSP already emits.
336
387
  *
337
388
  * # Errors
338
389
  *
@@ -367,10 +418,38 @@ export function start_lsp_worker() {
367
418
  }
368
419
  }
369
420
 
421
+ /**
422
+ * The name of every [`TokenRow::kind`], indexed BY that kind.
423
+ *
424
+ * `token_kinds()[row.kind]` is the variant name — `"Comment"`, `"KwFrom"`,
425
+ * `"String"`. A host maps names to highlight categories and never writes a
426
+ * discriminant down, which is the only version of this contract that survives
427
+ * a reorder of the lexer.
428
+ *
429
+ * This is the same move [`semantic_legend`] makes for LSP semantic tokens: the
430
+ * indices are meaningless without the legend, so ship the legend.
431
+ *
432
+ * A kind past the end of the array is a variant appended by a newer compiler
433
+ * than the host was built against. That is BACKWARDS-COMPATIBLE by
434
+ * construction: the host sees `undefined` and styles the span as plain text.
435
+ *
436
+ * # Errors
437
+ *
438
+ * Returns a JS error only if `serde_wasm_bindgen` fails to serialise a
439
+ * `Vec<&str>` (impossible in practice).
440
+ * @returns {any}
441
+ */
442
+ export function tokenKinds() {
443
+ const ret = wasm.tokenKinds();
444
+ if (ret[2]) {
445
+ throw takeFromExternrefTable0(ret[1]);
446
+ }
447
+ return takeFromExternrefTable0(ret[0]);
448
+ }
449
+
370
450
  /**
371
451
  * `JS`-facing tokenize. Returns the same row stream as [`tokenize_native`],
372
- * serialised via `serde_wasm_bindgen`. Consumed by
373
- * `@fossil-lang/codemirror-fossil`'s `StreamParser` (plan 08-08).
452
+ * serialised via `serde_wasm_bindgen`.
374
453
  *
375
454
  * # Errors
376
455
  *
@@ -499,6 +578,9 @@ function __wbg_get_imports() {
499
578
  wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
500
579
  }
501
580
  },
581
+ __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
582
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
583
+ }, arguments); },
502
584
  __wbg_get_652f640b3b0b6e3e: function(arg0, arg1) {
503
585
  const ret = arg0[arg1 >>> 0];
504
586
  return ret;
@@ -650,8 +732,8 @@ function __wbg_get_imports() {
650
732
  return ret;
651
733
  },
652
734
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
653
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 9, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
654
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6bdcc41945596778);
735
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
736
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h900f85fb942a113b);
655
737
  return ret;
656
738
  },
657
739
  __wbindgen_cast_0000000000000002: function(arg0) {
@@ -690,8 +772,8 @@ function __wbg_get_imports() {
690
772
  };
691
773
  }
692
774
 
693
- function wasm_bindgen__convert__closures_____invoke__h6bdcc41945596778(arg0, arg1, arg2) {
694
- wasm.wasm_bindgen__convert__closures_____invoke__h6bdcc41945596778(arg0, arg1, arg2);
775
+ function wasm_bindgen__convert__closures_____invoke__h900f85fb942a113b(arg0, arg1, arg2) {
776
+ wasm.wasm_bindgen__convert__closures_____invoke__h900f85fb942a113b(arg0, arg1, arg2);
695
777
  }
696
778
 
697
779
  const FileHandleFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file
@@ -4,20 +4,22 @@ export const memory: WebAssembly.Memory;
4
4
  export const start_lsp_worker: () => [number, number];
5
5
  export const tokenize: (a: number, b: number) => [number, number, number];
6
6
  export const semantic_legend: () => [number, number, number];
7
+ export const tokenKinds: () => [number, number, number];
7
8
  export const __wbg_filehandle_free: (a: number, b: number) => void;
8
9
  export const __wbg_fossilplayground_free: (a: number, b: number) => void;
9
10
  export const fossilplayground_new: () => number;
10
- export const fossilplayground_classification: (a: number) => [number, number, number];
11
11
  export const fossilplayground_open_file: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
12
12
  export const fossilplayground_update_file: (a: number, b: number, c: number, d: number) => [number, number];
13
13
  export const fossilplayground_close_file: (a: number, b: number) => [number, number];
14
14
  export const fossilplayground_check: (a: number) => [number, number, number];
15
15
  export const fossilplayground_diagnostics_for: (a: number, b: number) => [number, number, number];
16
- export const fossilplayground_set_target_shex: (a: number, b: number, c: number) => [number, number];
16
+ export const fossilplayground_hover: (a: number, b: number, c: number, d: number) => [number, number, number];
17
+ export const fossilplayground_completions: (a: number, b: number, c: number, d: number) => [number, number, number];
18
+ export const fossilplayground_gotoDefinition: (a: number, b: number, c: number, d: number) => [number, number, number];
17
19
  export const fossilplayground_registerInferredDescriptor: (a: number, b: number, c: number) => [number, number];
18
20
  export const providers: () => [number, number, number];
19
21
  export const refs: (a: number, b: number) => [number, number, number];
20
- export const wasm_bindgen__convert__closures_____invoke__h6bdcc41945596778: (a: number, b: number, c: any) => void;
22
+ export const wasm_bindgen__convert__closures_____invoke__h900f85fb942a113b: (a: number, b: number, c: any) => void;
21
23
  export const __wbindgen_malloc_command_export: (a: number, b: number) => number;
22
24
  export const __wbindgen_realloc_command_export: (a: number, b: number, c: number, d: number) => number;
23
25
  export const __wbindgen_exn_store_command_export: (a: number) => void;