pub struct Span {
pub start: u32,
pub end: u32,
pub capture: String,
pub pattern_index: u32,
}Expand description
A span of highlighted text.
Spans come from grammar parsers and contain the raw capture name (e.g., “keyword.function”, “include”, “string.special.symbol”). The capture name is later mapped to a theme slot for rendering.
Fields§
§start: u32Byte offset where the span starts (inclusive).
end: u32Byte offset where the span ends (exclusive).
capture: StringThe capture name from the grammar’s highlight query.
Examples: “keyword”, “function.builtin”, “include”, “storageclass”
All are mapped to theme slots via arborium_theme::tag_for_capture().
pattern_index: u32Pattern index from the query (higher = later in highlights.scm = higher priority).
When two spans have the exact same (start, end) range, the one with higher pattern_index wins during deduplication. This matches the tree-sitter convention where later patterns in a query override earlier ones.