Skip to main content

highlight_formula

Function highlight_formula 

Source
pub fn highlight_formula(
    text: &str,
    font: FontId,
    error: Option<Range<usize>>,
) -> LayoutJob
Expand description

Build a highlighted [LayoutJob] for text, coloring tokens per scan/color_for. If error is Some(start..end), those bytes (clamped to the text and to char boundaries; a span may cover part of a token or several) are rendered in ERROR_COLOR with a 2 px underline so the error’s location is visible inline. crate::diagnostics places it: the token at a parse error’s position, or the name a compile error names.