Skip to main content

resolve_doc_link_in

Function resolve_doc_link_in 

pub fn resolve_doc_link_in(
    index: &ProjectIndex,
    doc_scope: &HashMap<String, Vec<String>>,
    owner_unit: &str,
    name: &str,
    ctx: Option<&DocLinkContext<'_>>,
) -> DocLinkResolution
Expand description

#2454, #2531: the one doc-link resolver. A candidate resolves in order:

  1. the attached declaration’s own parts — a record’s fields, a capability’s ops, an agent’s handlers, a type’s methods (the index’s "Owner.member" entries), and a fn / handler / op’s parameters;
  2. the unit scope (see the scope walk above);
  3. a unit-qualified name (window.decide, a.b.Name): the last segment as a top-level declaration of the unit named by the rest, whether or not that unit is in scope.

An own part shadows a unit-level name of the same spelling. A dotted name still tries Owner.member (step 2) before the unit-qualified reading, so every link that resolved before resolves to the same target. With no ctx step 1 is skipped. When nothing resolves, the result says whether the unit-scope walk was Ambiguous or the name simply Unresolved.