Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

TokenCategoryTable

Defined in: packages/engine/src/language/TokenCategoryMap.ts:407

One engine’s highlight categories: the categories its packages registered for their own token types (IEnginePackage.tokenCategories), over the static table above, which it extends and never replaces, so a package cannot break core highlighting.

Each engine holds one on its EngineContext (#710). There used to be a single table for the whole process, so an editor asking one engine for a package keyword’s category got nothing once another engine had unregistered the same package.

new TokenCategoryTable(): TokenCategoryTable;

TokenCategoryTable

delete(tokenType): void;

Defined in: packages/engine/src/language/TokenCategoryMap.ts:427

Remove a token type’s package category. The built-in category, if any, applies again; an unknown type is ignored.

ParameterTypeDescription
tokenTypestringToken type to forget.

void


get(tokenType):
| TokenCategory
| undefined;

Defined in: packages/engine/src/language/TokenCategoryMap.ts:437

A token type’s category: a package’s first, then the built-in table’s.

ParameterType
tokenTypestring

| TokenCategory | undefined

The category, or undefined when the type has none, the signal to a UI adapter that the token renders unstyled.


set(tokenType, category): void;

Defined in: packages/engine/src/language/TokenCategoryMap.ts:417

Map a token type to a highlighting category.

ParameterTypeDescription
tokenTypestringToken type a package registered.
categoryTokenCategoryCategory deciding how an editor colours it.

void