Skip to content

createSemanticTokenStyles

createSemanticTokenStyles(options?): SemanticTokenStyles

Resolves a decoded token to a paintable style.

The resolver is the editor’s rather than the host’s for one reason that outranks preference: the theme is the editor’s and so are the registered colour ids, and a host that resolved styles itself would produce semantic colour that drifts from the tree-sitter and shiki colour in the same document. One resolver, one theme, one set of ids.

The result carries no font properties, because a highlight pseudo-element cannot apply them — VirtualizedTextHighlightStyle does not offer them, and this is the only shape that reaches the paint layer.

SemanticTokenStyleOptions

SemanticTokenStyles