Skip to main content

suggest_references

Function suggest_references 

Source
fn suggest_references(
    reference: &UnresolvedItemName,
    available: &[SourceReference],
) -> Vec<String>
Expand description

Exposed references spelled closely enough to reference to be the one the project meant, best first. Empty when nothing comes close.

A candidate whose object name is exactly right and whose namespace is not leads, no matter how unalike the two namespaces are. Naming the right object in the wrong schema is both a common slip and one edit distance scores as unrelated. The rest are ranked on the object name alone. Scoring the reference whole would let a shared namespace pad the distance budget without saying anything about whether the names match: public.widgets and public.orders sit 4 edits apart, inside the budget a name that long earns, and are nothing alike.

Suggestions carry the namespace even where the project wrote a bare reference. That stays a valid substitution and says where the object lives.