Function doc_link_suggestions
pub fn doc_link_suggestions(
index: &ProjectIndex,
doc_scope: &HashMap<String, Vec<String>>,
owner_unit: &str,
owner: Option<&str>,
ctx: Option<&DocLinkContext<'_>>,
) -> Vec<DocLinkSuggestion>Expand description
#2458: the names a doc link in owner_unit could resolve, in resolution
order — the single place completion defines that order:
- the attached declaration’s own parts (
ctx): a record’s fields, a capability’s ops, an agent’s handlers, a type’s methods, then a fn / handler / op’s parameters; - the unit scope — the same
doc_scopelistresolve_doc_link_inwalks (so a change to scope order or contents flows through), by position in that list and then by name.
A name is kept only when resolve_doc_link_in resolves it to that very
declaration, so suggestions and resolution agree. A bare name that does not
(shadowed by an own part or an earlier unit) is instead offered as
unit.Name when that qualified form resolves to it; one ambiguous within
its unit has no resolving form and is left out.
With owner: Some("Type") it offers that owner’s members (Type.member,
labelled by the member segment) from the unit scope only, then — when the
text names a project unit (#2525) — that unit’s top-level names.