Skip to main content

compute_code_block_lines

Function compute_code_block_lines 

Source
pub fn compute_code_block_lines(syntax: &SyntaxSnapshot) -> Option<Vec<u32>>
Expand description

MC.2: the source lines that lie inside a fenced (or indented) code block, for the full-width syntax.code_block background tint (markdown and any grammar exposing those node kinds).

Mirrors compute_syntax_folds: it runs the language’s fold query — the one registered query that already captures fenced_code_block / indented_code_block — and keeps only the code-block captures, expanding each to the individual source lines it covers. A grammar whose fold query captures no code block (every language but markdown today) yields an empty set, so no tint. Runs on the actor thread off the paint path, exactly like the fold recompute it rides beside.

Returned lines are sorted and de-duplicated (a BTreeSet collapses the overlap tree-sitter can report for the same range under multiple patterns).