(func: &FunctionInfo, content: &str)
| 327 | /// Convert a `FunctionInfo` to a `DocumentSymbol`. |
| 328 | #[allow(deprecated)] |
| 329 | fn 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 |
no test coverage detected