Skip to main content

name_to_style_with_theme

Function name_to_style_with_theme 

Source
pub fn name_to_style_with_theme(
    name: &str,
    theme: Option<&dyn ThemeRegistry>,
) -> Style
Expand description

TK.1: resolve a capture name that names a registered theme element rather than a builtin category.

Style::Element exists precisely for vocabularies that are open by nature — its own doc says a plugin “can register a theme element by name but can never add a variant to a Rust enum”. It was reachable from decorations and listing icons and not from a tree-sitter query, which is the gap this closes. Org’s TODO keywords are the first caller (org.todo.WAITING); nothing here knows that.

Builtin names win. A capture called keyword stays Style::Keyword even if some plugin registers an element under that name, because the closed categories are the editor’s own vocabulary and a plugin must not be able to redefine what keyword means for every language at once.

theme is None wherever no registry is in hand — the native LangRegistry::standard() path, and every test that does not care. Then this is exactly the pre-TK.1 mapping.