Skip to main content

resolve_name_in_scope

Function resolve_name_in_scope 

Source
pub fn resolve_name_in_scope(
    cache: &CompletionCache,
    name: &str,
    byte_pos: usize,
    file_id: FileId,
) -> Option<String>
Expand description

Resolve a variable name to its type by walking up the scope chain.

Starting from the innermost scope at the cursor position, check each scope’s declarations for a matching name. If not found, follow scope_parent to the next enclosing scope and check again. Stop at the first match.

Falls back to resolve_name_to_type_id (flat lookup) if scope resolution finds nothing, or if the scope data is unavailable.