Skip to main content

register_with_grammar_themed

Function register_with_grammar_themed 

Source
pub fn register_with_grammar_themed(
    name: &str,
    extensions: &[&str],
    grammar: &GrammarSpec,
    provenance: u64,
    theme: Option<&dyn ThemeRegistry>,
) -> Result<LanguageName, LanguageRegistrationError>
Expand description

register_with_grammar, with the theme registry in hand (TK.1).

A capture name in this language’s highlights.scm that is not a builtin category but IS a registered theme element resolves to Style::Element — which is how org’s TODO keywords get one colour each without the editor learning what a TODO keyword is.

The elements must already be registered when this is called. The loader drains the theme seam before the language seam for that reason; a capture naming an element that does not exist yet resolves to Style::Default and renders unstyled, which is a silent failure rather than a loud one. It is the same drain-order gate OM.0 established for grammar before modes.