MCPcopy Create free account
hub / github.com/CodeBendKit/codeseek / _extract_function_signature

Method _extract_function_signature

rust-core/src/codegraph/parser.rs:549–564  ·  view source on GitHub ↗

提取函数签名

(&self, symbol: &dyn crate::codegraph::treesitter::ast_instance_structs::AstSymbolInstance)

Source from the content-addressed store, hash-verified

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);

Callers 1

Calls 4

declaration_rangeMethod · 0.80
full_rangeMethod · 0.80
to_stringMethod · 0.80
nameMethod · 0.80

Tested by

no test coverage detected