Skip to main content

value_receiver_rewrite

Function value_receiver_rewrite 

Source
pub fn value_receiver_rewrite(
    text: &str,
    offset: usize,
) -> Option<(String, usize)>
Expand description

If the cursor (byte offset into text) sits just after a lowercase receiver.(partial) — a value receiver — return the buffer rewritten so the receiver is a complete expression (the trailing .partial dropped, so the file parses) and the byte offset of the receiver to type. Returns None for an uppercase name receiver (slice 2), a decimal 1., or a .-qualified segment.

The rewrite is the spike’s fix for the mid-edit parse: a bare email. cascades and loses the receiver, but email (dot dropped) types cleanly.