Skip to main content

describe_self_at

Function describe_self_at 

Source
pub fn describe_self_at(
    text: &str,
    offset: usize,
    expr_types: &[(Span, TyId)],
    tys: &Types,
) -> Option<String>
Expand description

v0.122 (editor-currency slice 1): a hover summary for self under the cursor — self: <Type>. self is a reserved keyword (never an Ident, so it does not flow through locals_nav), but a self use is a typed expression, so its type is in expr_types at the token’s span. For a method the type is the receiver’s name; for an agent handler the checker gives self a synthetic record type __<Agent>Self (to resolve self.<key>), which is un-synthesised here to <Agent>. None when the cursor is not on the self keyword or its type is unknown (no expr_types entry for it — on a broken buffer ADR 0094’s partial types usually still carry one; when they don’t, this degrades to the keyword doc).