Skip to main content

build_reference_excerpts

Function build_reference_excerpts 

Source
pub fn build_reference_excerpts(
    locations: &[Location],
) -> Option<(HashMap<BufferId, Arc<dyn Document>>, Vec<Excerpt>, usize)>
Expand description

Group locations into per-file sources + excerpts.

Returns (sources, excerpts, n_files), or None when there is nothing to show — no locations, or every referenced file unreadable. Shared by open and refresh so the two cannot drift.

Files appear in first-seen order and locations within a file are ordered by line, which gives a stable layout across refreshes. A file that fails to read is logged and skipped: one unreadable path must not cost the user every other reference.