Commit b052e7a
feat(stdlib): async-extern binding surface — Thenable + withProgress/sendRequest
#103 slice 1 (Promise-returning extern, per owner decision). The
AffineScript extern-call shape is synchronous, so Thenable-returning
vscode APIs could not be bound at all; the rsr-certifier vscode port
fell back to shelling out to the CLI.
Adds the binding surface only (smallest root-cause slice):
- stdlib/Vscode.affine: `extern type Thenable;` +
`withProgressNotification(title, work_thunk) -> Thenable / Async`.
- stdlib/VscodeLanguageClient.affine:
`languageClientSendRequest(c, method, params_json) -> Thenable / Async`.
No backend change needed: the Deno/Node source-to-source backend already
lowers an unlisted extern to a plain host call, so a Thenable-returning
extern emits a real JS Promise and a consumer's `await` is valid source
JS. The `Async` effect (v1 registry, PR-1 #196) tracks it in signatures.
Verified: both files typecheck standalone; dune test 253/253 (incl. the
AOT Vscode smoke); a consumer compiled with --deno-esm emits
`return languageClientSendRequest("rsr/getCompliance", "{}")` — a plain
awaitable host call.
Deferred to follow-up slices (per scope): vscode-host JS impl in
packages/affine-vscode/mod.js, and the rsr-certifier pilot restore.
Refs #103
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent e1c1591 commit b052e7a
2 files changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments