Skip to content

State and view extensions

State and view extensions

RequirementPlume primitive
Combine contributions from several extensionsDefine a Facet and install contributions with its Of member. Read the result through editor.Facet.
Keep a value that evolves with transactionsDefine a StateField with initialization and update logic. Read it through editor.Field.
Replace a group of extensions while the editor is openInstall a Compartment and dispatch Tx.effect (slot.Reconfigure replacement).
Attach state or behavior to a mounted viewDefine a ViewPlugin, install its extension and use ViewPlugin.tryGet on the mounted view.

For syntax highlighting, create a line tokenizer with Language.ofLineLexer and install it with Language.extension. Return token spans relative to the line and assign a Tag to each span. Describe the presentation separately using HighlightStyle.define. Keeping the token data independent of CSS lets a theme change without rewriting the lexer.

The showcase implements a working lexer and reconfigurable editor.

Edit this page