Skip to main content

unit_name_at

Function unit_name_at 

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

#1885: the qualified unit name under offset, when the cursor sits on the file’s own unit-header name or on a uses/consumes (or a suite’s) target path — the positions where hover shows a unit’s module doc.

The match is on the name’s byte range (start..=end), never on Span equality, so it holds for a buffer re-parsed with FileId::UNKNOWN. Every segment of a dotted path answers with the whole name: the cursor on model in uses compat.model names compat.model, not a model.