Commit 0e2e402
feat(affine-vscode): implement withProgressNotification runtime adapter
stdlib/Vscode.affine:307 declares
`withProgressNotification(title, work: fn(Unit) -> Thenable) -> Thenable / Async`,
but packages/affine-vscode/mod.js had no runtime impl — calling it from
the wasm/Node backend faulted (undefined extern). Surfaced by the first
#205 consumer (rsr-certifier extension rewire, standards#123), which had
to omit progress UI and document the gap.
Adds the impl following the established async-extern convention exactly:
- `work` is the #199 closure (`fn(Unit) -> Thenable`); invoking it via
wrapHandler returns the guest's Thenable *handle*, resolved through
the shared handle table.
- The overall progress Thenable is `reg`-ed so the guest observes
completion with thenableThen / thenableResultJson, identical to
httpPostJson (#210).
- Failures settle as `{ __error }` — the same reject shape thenableThen
/ httpPostJson use, so guests branch to a fallback uniformly.
- Graceful degradation: if the host has no `withProgress`
(non-VS Code / test runner), the work still runs; only the progress
chrome is skipped (mirrors httpPostJson's fetch-unavailable stance).
Pure adapter addition — no stdlib/compiler change (the extern was
already declared). Node syntax-checked; full dune gate green (257/257),
zero regression.
Closes #212
Refs #199 #205 #210 #211 ; consumer hyperpolymath/standards#123
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent d620b41 commit 0e2e402
1 file changed
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
408 | 439 | | |
409 | 440 | | |
410 | 441 | | |
| |||
0 commit comments