KodeMirror

fun KodeMirror(session: EditorSession, modifier: Modifier = Modifier)

The main editor composable.

Wires up the EditorSession with plugin hosting, layout caching, and input handling, then renders the editor content.

Height contract

The editor fills the height it is given. Callers should place it under a bounded vertical constraint — e.g. a parent that constrains height, or Modifier.height(...) / Modifier.heightIn(max = ...). Under a bounded height the inner line list scrolls and caret reveal (scroll-into-view) keeps the caret on screen, matching CodeMirror 6, where the editor scroller is given a height (often a max-height).

If the editor is placed under an unbounded vertical constraint — e.g. a parent with Modifier.verticalScroll(...), wrapContentHeight(), or inside another vertically scrolling container — there is no bounded height to fill. In that case the editor grows to its full content height (the whole document is laid out and the outer container scrolls). It will NOT collapse to zero height. Note that under unbounded constraints the editor's own scroll-into-view cannot keep the caret visible (there is nothing to scroll within the editor); the surrounding scroll container governs visibility.

Parameters

session

The EditorSession to display.

modifier

Modifier applied to the outermost container.