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

Method active_var_def_offset

src/symbol_map/mod.rs:674–679  ·  view source on GitHub ↗

Return the `effective_from` offset of the most recent definition of `$var_name` that is visible at `cursor_offset`, or `0` if no definition is found. This is used as a cache-key discriminator: two accesses to the same variable that fall under the same definition share a cache entry, but accesses before vs. after a reassignment get different entries.

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

Source from the content-addressed store, hash-verified

672 /// entry, but accesses before vs. after a reassignment get different
673 /// entries.
674 pub fn active_var_def_offset(&self, var_name: &str, cursor_offset: u32) -> u32 {
675 let scope_start = self.find_enclosing_scope(cursor_offset);
676 self.find_var_definition(var_name, cursor_offset, scope_start)
677 .map(|d| d.effective_from)
678 .unwrap_or(0)
679 }
680
681 /// Check whether `cursor_offset` is physically sitting on a variable
682 /// definition token (the `$var` token of an assignment LHS, parameter,

Callers 1

Calls 3

find_enclosing_scopeMethod · 0.80
find_var_definitionMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected