Skip to main content

ExcerptHighlighter

Trait ExcerptHighlighter 

Source
pub trait ExcerptHighlighter: Send + Sync {
    // Required methods
    fn highlight_lines(&self, lo: u32, hi: u32) -> Option<Vec<Vec<StyledSpan>>>;
    fn highlight_version(&self) -> u64;
}
Expand description

Trait implemented by SyntaxHandle (and future highlight providers). Used by Document::excerpt_highlights so that lattice-runtime can expose per-excerpt highlighting through the Document trait without taking a direct dep on lattice-syntax.

Required Methods§

Source

fn highlight_lines(&self, lo: u32, hi: u32) -> Option<Vec<Vec<StyledSpan>>>

Return per-line styled spans for source rows lo..hi (exclusive). The returned Vec has exactly (hi - lo) entries; an empty inner Vec means “no spans on that line” (fall back to default fg). Returns None when the highlight snapshot is stale or unavailable.

Source

fn highlight_version(&self) -> u64

Monotonic version of the last-published parse result. Used to build MatrixVersion::syntax without taking a dep on SyntaxHandle internals.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§