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

Function build_function_detail

src/document_symbols.rs:431–460  ·  view source on GitHub ↗

Build a detail string for a standalone function showing its signature.

(func: &FunctionInfo)

Source from the content-addressed store, hash-verified

429
430/// Build a detail string for a standalone function showing its signature.
431fn build_function_detail(func: &FunctionInfo) -> Option<String> {
432 let mut detail = String::new();
433
434 detail.push('(');
435 let params: Vec<String> = func
436 .parameters
437 .iter()
438 .map(|p| {
439 let mut s = String::new();
440 if let Some(ref t) = p.type_hint {
441 s.push_str(&t.to_string());
442 s.push(' ');
443 }
444 if p.is_variadic {
445 s.push_str("...");
446 }
447 s.push_str(&p.name);
448 s
449 })
450 .collect();
451 detail.push_str(&params.join(", "));
452 detail.push(')');
453
454 if let Some(ref ret) = func.return_type {
455 detail.push_str(": ");
456 detail.push_str(&ret.to_string());
457 }
458
459 Some(detail)
460}
461
462/// Find the start of a class/interface/trait/enum name token after the
463/// keyword at `keyword_offset`. Scans forward past whitespace to find

Callers 2

function_to_symbolFunction · 0.85

Calls 3

pushMethod · 0.80
iterMethod · 0.80
mapMethod · 0.45

Tested by 1