MatchDecorator

class MatchDecorator(regexp: Regex, decorate: (add: (from: Int, to: Int, deco: Decoration) -> Unit, match: MatchResult, view: EditorSession) -> Unit, maxLength: Int)

Port of matchdecorator.ts — applies a decoration to every match of a regular expression in the visible document range.

Parameters

regexp

The regular expression to match. Must have the g flag (or Kotlin's findAll equivalent).

decorate

Called for each match; returns a Decoration (or null to skip this match).

boundary

Optional positive-lookahead boundary (not used in Kotlin port).

maxLength

Maximum characters to scan per viewport update. Defaults to 1 000 000 (effectively unbounded).

Constructors

Link copied to clipboard
constructor(regexp: Regex, decorate: (add: (from: Int, to: Int, deco: Decoration) -> Unit, match: MatchResult, view: EditorSession) -> Unit, maxLength: Int)

Functions

Link copied to clipboard

Scan the viewport of view for matches and return a fresh DecorationSet.

Link copied to clipboard

Incrementally update deco after update. Only rescans regions that changed or moved into the viewport.