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,
)
| 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 | /// |
no test coverage detected