Skip to main content

doc_link_mentions

Function doc_link_mentions 

Source
pub fn doc_link_mentions(
    index: &ProjectIndex,
    doc_scope: &HashMap<String, Vec<String>>,
    snapshots: &HashMap<PathBuf, String>,
    locals: &FileLocals,
    target: &SiteRef,
) -> Vec<DocLinkMention>
Expand description

#2456: every doc-link mention in snapshots that resolves (through resolve_doc_link_in, with the declaration each comment is attached to as context, so a bare [field] in its own record’s doc counts) to the definition at target. locals is the round’s per-file local bindings.

This is the reverse of resolve_doc_link_in: rename uses it to rewrite the mention, and it is the lookup that find-references and document-highlight are meant to report doc-link mentions through (#2457). target is a definition site, as held in SymbolEntry::def.

Only files whose doc-link scope contains the defining unit are scanned, and a file whose text does not contain the name’s last segment is skipped before it is tokenised. A suite file has no own unit name and is skipped, matching textDocument/documentLink. Mentions come back in file then source order.