提取函数签名
(&self, symbol: &dyn crate::codegraph::treesitter::ast_instance_structs::AstSymbolInstance)
| 547 | |
| 548 | /// 提取函数签名 |
| 549 | fn _extract_function_signature(&self, symbol: &dyn crate::codegraph::treesitter::ast_instance_structs::AstSymbolInstance) -> Option<String> { |
| 550 | // 使用声明范围来获取函数签名 |
| 551 | let decl_range = symbol.declaration_range(); |
| 552 | let full_range = symbol.full_range(); |
| 553 | |
| 554 | // 尝试从声明范围提取签名 |
| 555 | if decl_range.start_point.row != full_range.start_point.row || |
| 556 | decl_range.end_point.row != full_range.end_point.row { |
| 557 | // 如果声明范围与完整范围不同,说明有更精确的签名信息 |
| 558 | let signature = format!("{}()", symbol.name()); |
| 559 | return Some(signature); |
| 560 | } |
| 561 | |
| 562 | // 否则返回函数名作为签名 |
| 563 | Some(symbol.name().to_string()) |
| 564 | } |
| 565 | |
| 566 | fn _extract_namespace_from_content(&self, content: &str, file_path: &PathBuf) -> String { |
| 567 | let language = self._detect_language(file_path); |
no test coverage detected