Commit e052af6
authored
feat(vnext): add disposable completion info (#200)
## Summary
- expose an opt-in, type-safe completion info resolver on the vNext
CodeMirror adapter
- give every resolver an AbortSignal and require explicit DOM resource
cleanup
- abort pending work and destroy resolved UI on option, document,
context, region, or view changes
- contain resolver/cleanup failures and reject cleanup reentrancy
- document the React-root integration pattern and export the public
resolver types
## Verification
- 43 test files; 2,036 passed and 1 expected failure
- changed coverage: 98.15% statements, 95.90% branches, 100% functions,
99.20% lines
- all strict/loose/demo TypeScript configurations pass
- oxlint and test-integrity checks pass
- build and runtime export smoke pass
- two independent exact-head adversarial reviews approve
`e07f8e525d6e6f2c7f73e24acd4e1f0b1ff90cc0`
Stacked on #199, now merged into `dev-refactor`.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds opt-in rich completion info to the vNext CodeMirror adapter.
Introduces a type-safe `infoResolver` that returns a disposable DOM
panel, with automatic abort and cleanup on selection or editor changes.
- **New Features**
- `autocomplete.infoResolver(item, { signal })` lets you render rich
info and return `{ dom, destroy }`; pending work is aborted and resolved
resources are destroyed on option selection changes,
document/context/region updates, or view disposal.
- Stale results are ignored; null results omit the panel; resolver and
cleanup failures are contained; reentrancy during cleanup is rejected.
- Docs updated with a React root example; exported
`SqlCompletionInfoResolver`, `SqlCompletionInfoResolverContext`, and
`SqlDisposableCompletionInfo` from `src/vnext/codemirror/index.ts`.
- **Migration**
- Opt in by passing `sqlEditor({ autocomplete: { infoResolver } })`.
- Your resolver should use the provided `AbortSignal` and return `{ dom,
destroy }` or `null`.
<sup>Written for commit e07f8e5.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/marimo-team/codemirror-sql/pull/200?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->1 parent 246fa6f commit e052af6
5 files changed
Lines changed: 504 additions & 6 deletions
File tree
- docs/vnext
- src/vnext/codemirror
- __tests__
- test/vnext-types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
50 | 73 | | |
51 | 74 | | |
52 | 75 | | |
| |||
0 commit comments