TreeIndentContext

class TreeIndentContext(state: EditorState, val pos: DocPos, simulateBreak: DocPos? = null, simulateDoubleBreak: Boolean = false) : IndentContext

Extended indent context with access to the syntax tree for tree-based indentation strategies.

Constructors

Link copied to clipboard
constructor(state: EditorState, pos: DocPos, simulateBreak: DocPos? = null, simulateDoubleBreak: Boolean = false)

Properties

Link copied to clipboard

The base indentation of the line the node starts on.

Link copied to clipboard

The base indentation from the node itself.

Link copied to clipboard

The current context node. Initially the innermost node at the indent position, but updated by indentFrom to the node bearing the indent strategy before the strategy function is called.

Link copied to clipboard
val pos: DocPos
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The text on the line after the indent position.

Link copied to clipboard

The text content of the document.

Link copied to clipboard
val unit: Int

The indent unit size for this state.

Functions

Link copied to clipboard
fun column(pos: Int, bias: Int = 1): Int

Get the column of a given position.

Link copied to clipboard
fun continueAt(): Int?

Skip to parent node's indent strategy. Use this when a node's strategy doesn't want to handle the current case and defers to an ancestor.

Link copied to clipboard
fun lineAt(pos: DocPos, bias: Int = 1): Line

Get the text of a document line by position.

Link copied to clipboard
fun lineIndent(pos: DocPos, bias: Int = 1): Int

Get the indentation column at the start of a line.