Skip to content

Events

Subscribe with typed helpers or the bus.

kotlin
val unsub = controller.onTextChanged { event ->
    // event.changes, event.kind, event.source
}
unsub()

controller.events.subscribe<CursorChangedEvent> { }

dispose() and leaving composition (via controller dispose only) clear the bus. The composable does not auto-clear events on detach.

EditorEvent types

TypeFields
TextChangedEventchanges: List<TextChange>, kind, source
CursorChangedEventcursorPosition
SelectionChangedEventhasSelection, selection, cursorPosition
ScrollChangedEventscrollX, scrollY
ScaleChangedEventscale
DocumentLoadedEventlineCount
FoldToggleEventline
GutterIconClickEventline, column, iconId, locationInEditor
InlayHintClickEventline, column, locationInEditor
CodeLensClickEventline, column, locationInEditor
LongPressEventcursorPosition, locationInEditor
DoubleTapEventcursorPosition, locationInEditor
ContextMenuEventcursorPosition, locationInEditor
ContextMenuItemClickEventitem, request
SelectionMenuItemClickEventitemId
LinkClickEventline, column, target, locationInEditor

TextChange is range + newText.

Source and kind

EditorActionSource: NONE, SETUP, PROGRAMMATIC, KEYBOARD, IME, GESTURE, ANIMATION, DECORATION, FOLDING, SEARCH, LINKED_EDITING, DIFF.

TextChangeKind: NONE, INSERTION, REPLACEMENT, DELETION, MOVE, UNDO, REDO, MIXED.

Query APIs never return an action result. Mutations go through one session dispatch and then these events.