tree_sitter_highlight::c_lib

Function ts_highlighter_add_language

Source
#[no_mangle]
pub unsafe extern "C" fn ts_highlighter_add_language(
    this: *mut TSHighlighter,
    language_name: *const c_char,
    scope_name: *const c_char,
    injection_regex: *const c_char,
    language: Language,
    highlight_query: *const c_char,
    injection_query: *const c_char,
    locals_query: *const c_char,
    highlight_query_len: u32,
    injection_query_len: u32,
    locals_query_len: u32,
) -> ErrorCode
Expand description

Add a language to a TSHighlighter instance.

Returns an ErrorCode indicating whether the language was added successfully or not.

ยงSafety

this must be non-null and must be a valid pointer to a TSHighlighter instance created by ts_highlighter_new.

The caller must ensure that any *const c_char (C-style string) parameters are valid for the lifetime of the TSHighlighter instance, and are non-null.