Skip to main content

resolve_citations

Function resolve_citations 

Source
pub(crate) fn resolve_citations(
    document: &mut Document,
    diagnostics: &mut Vec<Diagnostic>,
    bibliography: LoadedBibliography,
) -> (Bibliography, bool)
Expand description

Resolve citation keys against the already-loaded bibliography sources.

Known citations are rewritten to dense numeric labels assigned by first-use order. Unknown keys emit MOS0045 and keep [?key?] placeholders.

Numbering is dense over known citations: a key consumes a number only when it resolves, and repeated uses of the same key reuse its first number. Unresolved keys never burn a slot, so [1], [2], … always index real bibliography records. This is the numeric-placeholder slice (issue #67), not full CSL: no author-year styles, sorted output, or citation clusters. Resolve [@key] citations and return the records loaded from the declared bibliography sources, merged across sources, and whether every source loaded successfully. The reference resolver consumes their key set to tell an @key label reference that misses the label index but matches a bibliography key apart – a near-certain “meant a citation” mistake – from a plain unknown label (see crate::resolve::resolve); the LSP offers the same records as citation completions.