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

Method resolve_see_refs

src/hover/mod.rs:322–354  ·  view source on GitHub ↗

Resolve `@see` references to file locations where possible. For each raw `@see` string, attempts to resolve symbol references (class names, `Class::member()`, `Class::$prop`) to a `file://` URI with a line fragment so that the hover popup renders them as clickable links. URLs and unresolvable symbols get `None`.

(
        &self,
        see_refs: &[String],
        uri: &str,
        content: &str,
    )

Source from the content-addressed store, hash-verified

320 /// URI with a line fragment so that the hover popup renders them as
321 /// clickable links. URLs and unresolvable symbols get `None`.
322 pub(crate) fn resolve_see_refs(
323 &self,
324 see_refs: &[String],
325 uri: &str,
326 content: &str,
327 ) -> Vec<ResolvedSeeRef> {
328 see_refs
329 .iter()
330 .map(|raw| {
331 // Extract the first token (the symbol or URL).
332 let target = raw
333 .split_once(|c: char| c.is_whitespace())
334 .map(|(t, _)| t.trim())
335 .unwrap_or(raw.as_str());
336
337 // URLs don't need resolution.
338 if target.starts_with("http://") || target.starts_with("https://") {
339 return ResolvedSeeRef {
340 raw: raw.clone(),
341 location_uri: None,
342 };
343 }
344
345 // Try to resolve as a class or class::member reference.
346 let location_uri = self.resolve_see_target(target, uri, content);
347
348 ResolvedSeeRef {
349 raw: raw.clone(),
350 location_uri,
351 }
352 })
353 .collect()
354 }
355
356 /// Resolve a single `@see` target to a `file://` URI with line fragment.
357 ///

Callers 4

resolve_functionMethod · 0.80
hover_function_callMethod · 0.80
hover_for_methodMethod · 0.80
hover_for_class_infoMethod · 0.80

Calls 5

iterMethod · 0.80
as_strMethod · 0.80
cloneMethod · 0.80
resolve_see_targetMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected