Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/vnext/codemirror-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,29 @@ The adapter installs one coherent `autocompletion` configuration. Additional
sources belong in `autocomplete.externalSources`; consumers should not install
a second independently configured `autocompletion` extension.

Rich completion details are opt-in through
`autocomplete.infoResolver`. The resolver receives the immutable core item and
an `AbortSignal`, and returns a DOM resource with an explicit `destroy`
callback. The adapter aborts pending work and destroys resolved resources when
the selected option, document input, context, regions, or view lifetime
changes. Resolver failures are contained and simply omit the detail panel.

```ts
const support = sqlEditor({
autocomplete: {
infoResolver: async (item, { signal }) => {
const metadata = await loadMetadata(item, { signal });
const dom = document.createElement("div");
const root = createRoot(dom);
root.render(renderMetadata(metadata));
return { dom, destroy: () => root.unmount() };
},
},
initialContext,
service,
});
```

## Atomic inputs

Context and document changes can share one CodeMirror transaction:
Expand Down
Loading
Loading