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

Function function_to_symbol

src/document_symbols.rs:329–356  ·  view source on GitHub ↗
(func: &FunctionInfo, content: &str)

Source from the content-addressed store, hash-verified

327/// Convert a `FunctionInfo` to a `DocumentSymbol`.
328#[allow(deprecated)]
329fn function_to_symbol(func: &FunctionInfo, content: &str) -> Option<DocumentSymbol> {
330 if func.name_offset == 0 {
331 return None;
332 }
333
334 let pos = offset_to_position(content, func.name_offset as usize);
335 let name_end = offset_to_position(content, func.name_offset as usize + func.name.len());
336 let selection_range = Range::new(pos, name_end);
337 let range = selection_range;
338
339 let detail = build_function_detail(func);
340 let tags = if func.deprecation_message.is_some() {
341 Some(vec![SymbolTag::DEPRECATED])
342 } else {
343 None
344 };
345
346 Some(DocumentSymbol {
347 name: func.name.to_string(),
348 detail,
349 kind: SymbolKind::FUNCTION,
350 tags,
351 deprecated: None,
352 range,
353 selection_range,
354 children: None,
355 })
356}
357
358// ── Detail string builders ──────────────────────────────────────────
359

Callers 1

Calls 2

offset_to_positionFunction · 0.85
build_function_detailFunction · 0.85

Tested by

no test coverage detected