Skip to content

EditorDecorationStore

Decorations that follow the text on their own, keyed by id and attributed to an owner.

Registering is the point: an owner hands a range over once and stops thinking about it, rather than re-deriving every offset it holds after each keystroke. Owners still replace their own set when what they mean has changed — a new word under the caret, a fresh batch of diagnostics — but a plain edit is the store’s problem, not theirs.

new EditorDecorationStore(): EditorDecorationStore

EditorDecorationStore

add(spec): string

EditorDecorationSpec

string


applyEdits(edits): void

Moves every decoration through edits, dropping the ones the edits swallowed whole.

Every decoration after an edit shifts, so all of them are visited; the indexes only lose their running maxima, which the next query rebuilds.

readonly TextEdit[]

void


clear(): void

void


decorationsInRange(surface, start, end): readonly EditorDecoration[]

EditorDecorationSurface

number

number

readonly EditorDecoration[]


remove(id): boolean

string

boolean


replaceOwner(owner, specs): boolean

Swaps everything owner holds for specs and reports whether anything has to be repainted. Owners recompute on every caret move and every scroll, so most of those calls hand back the set that is already stored, and the answer is what spares them the paint.

string

readonly EditorDecorationSpec[]

boolean