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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EditorDecorationStore():
EditorDecorationStore
Returns
Section titled “Returns”EditorDecorationStore
Methods
Section titled “Methods”add(
spec):string
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string
applyEdits()
Section titled “applyEdits()”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.
Parameters
Section titled “Parameters”readonly TextEdit[]
Returns
Section titled “Returns”void
clear()
Section titled “clear()”clear():
void
Returns
Section titled “Returns”void
decorationsInRange()
Section titled “decorationsInRange()”decorationsInRange(
surface,start,end): readonlyEditorDecoration[]
Parameters
Section titled “Parameters”surface
Section titled “surface”number
number
Returns
Section titled “Returns”readonly EditorDecoration[]
remove()
Section titled “remove()”remove(
id):boolean
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
replaceOwner()
Section titled “replaceOwner()”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.
Parameters
Section titled “Parameters”string
readonly EditorDecorationSpec[]
Returns
Section titled “Returns”boolean