feat(vnext): add CodeMirror completion adapter#199
Merged
Conversation
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
Light2Dark
marked this pull request as ready for review
July 25, 2026 17:28
This was referenced Jul 25, 2026
Light2Dark
added a commit
that referenced
this pull request
Jul 25, 2026
## 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. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@marimo-team/codemirror-sql/vnext/codemirrorentry point with one caller-owned service and one session perEditorViewWhy
The framework-independent service now has the identity and lease contracts needed for a thin editor boundary. This adapter makes those contracts usable without leaking CodeMirror into the core, while preserving marimo's external completion sources and treating transformed-document regions explicitly rather than guessing their mapping.
Validation
8d72a4cSummary by cubic
Adds a CodeMirror 6 adapter for the vNext SQL language service, exposed as
@marimo-team/codemirror-sql/vnext/codemirror. This enables exact, guarded completion edits and atomic document/context/region updates without leaking CodeMirror into the core.New Features
sqlEditoradapter with one document session perEditorView; caller owns the sharedservice.support.contextEffectandsupport.embeddedRegionsEffect.autocompletionconfiguration; supportsexternalSourcesfor extra providers.docs/vnext/codemirror-adapter.md; subpath export added inpackage.json; smoke test updated.Migration
@marimo-team/codemirror-sql/vnext/codemirror, create a service from@marimo-team/codemirror-sql/vnext, then addsupport.extensionto the editor.autocompletionextension; pass extra providers viaexternalSources.support.setContextor by dispatchingsupport.contextEffectandsupport.embeddedRegionsEffect. If embedded regions exist, include the complete resulting set on every document-changing transaction.Written for commit 8d72a4c. Summary will update on new commits.