MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / lookup_var_definition

Method lookup_var_definition

src/definition/resolve.rs:104–115  ·  view source on GitHub ↗

Look up the most recent variable definition before `cursor_offset` in the precomputed symbol map for `uri`. Returns a cloned [`VarDefSite`] (if found) so that the mutex lock is not held across the resolution logic.

(
        &self,
        uri: &str,
        var_name: &str,
        cursor_offset: u32,
    )

Source from the content-addressed store, hash-verified

102 /// Returns a cloned [`VarDefSite`] (if found) so that the mutex lock
103 /// is not held across the resolution logic.
104 fn lookup_var_definition(
105 &self,
106 uri: &str,
107 var_name: &str,
108 cursor_offset: u32,
109 ) -> Option<crate::symbol_map::VarDefSite> {
110 let maps = self.symbol_maps.read();
111 let map = maps.get(uri)?;
112 let scope_start = map.find_enclosing_scope(cursor_offset);
113 map.find_var_definition(var_name, cursor_offset, scope_start)
114 .cloned()
115 }
116
117 /// If the cursor is physically sitting on a variable definition token
118 /// (assignment LHS, parameter, foreach binding, etc.), return the

Callers 1

resolve_from_symbolMethod · 0.80

Calls 3

find_enclosing_scopeMethod · 0.80
find_var_definitionMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected