Usage
This page gives a practical overview of how SweetEditor is typically used in a Compose Multiplatform application.
Core Concepts
SweetEditor: the composable editor surfaceSweetEditorController: controller for editing, commands, providers, and runtime integrationEditorState: editor state and platform bridge lifecycleEditorDocument: the active document bridge
Typical Integration Flow
- Create or remember a
SweetEditorController - Load a document into the controller
- Attach completion providers or decoration providers as needed
- Render
SweetEditor - React to editor events through the controller event bus
Common Extension Points
Decorations
Use decoration providers to add:
- inlay hints
- phantom text
- diagnostics
- gutter icons
- fold regions
- guides and highlights
Completion
Completion providers can return:
- popup items
- anchors
- selection updates
- custom item renderers
Copilot-style Inline Suggestions
SweetEditor also supports copilot-style inline suggestions in the Compose layer:
- show an
InlineSuggestion - render it as phantom text
- accept with
Tab - dismiss with
Escape