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

Method resolve_member_declaration_hierarchy

src/references/mod.rs:1208–1231  ·  view source on GitHub ↗

Resolve the class hierarchy for a `MemberDeclaration` at a given offset. Finds the enclosing class and builds the hierarchy set from it.

(
        &self,
        uri: &str,
        offset: u32,
    )

Source from the content-addressed store, hash-verified

1206 ///
1207 /// Finds the enclosing class and builds the hierarchy set from it.
1208 fn resolve_member_declaration_hierarchy(
1209 &self,
1210 uri: &str,
1211 offset: u32,
1212 ) -> Option<HashSet<String>> {
1213 let classes: Vec<Arc<ClassInfo>> = self
1214 .uri_classes_index
1215 .read()
1216 .get(uri)
1217 .cloned()
1218 .unwrap_or_default();
1219 let current_class = find_class_at_offset(&classes, offset).or_else(|| {
1220 // Fallback: offset may be in a class docblock (before the opening
1221 // brace). Find the nearest class whose body starts past the
1222 // offset, meaning its docblock region likely contains the offset.
1223 classes
1224 .iter()
1225 .map(|c| c.as_ref())
1226 .filter(|c| c.keyword_offset > 0 && offset < c.start_offset)
1227 .min_by_key(|c| c.start_offset)
1228 })?;
1229 let fqn = current_class.fqn().to_string();
1230 Some(self.collect_hierarchy_for_fqns(&[fqn]))
1231 }
1232
1233 /// Resolve a member access subject to zero or more class FQNs.
1234 ///

Callers 1

Calls 7

find_class_at_offsetFunction · 0.85
filterMethod · 0.80
iterMethod · 0.80
fqnMethod · 0.80
getMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected