(language: TsLanguageKind, key: &str, node: Node)
| 288 | |
| 289 | #[cfg(feature = "tree-sitter-ast")] |
| 290 | fn normalize_kind(language: TsLanguageKind, key: &str, node: Node) -> String { |
| 291 | match (language, key) { |
| 292 | (TsLanguageKind::Rust, "function") => { |
| 293 | if let Some(parent) = node.parent() { |
| 294 | if matches!(parent.kind(), "impl_item" | "trait_item") { |
| 295 | return "method".to_string(); |
| 296 | } |
| 297 | } |
| 298 | "function".to_string() |
| 299 | } |
| 300 | (TsLanguageKind::Rust, "impl") => "impl".to_string(), |
| 301 | (TsLanguageKind::Rust, other) => other.to_string(), |
| 302 | (TsLanguageKind::Python, "decorated") => { |
| 303 | if let Some(target) = decorated_target(node) { |
| 304 | return normalize_kind(language, target.kind(), target); |
| 305 | } |
| 306 | "decorated".to_string() |
| 307 | } |
| 308 | (_, "function") => "function".to_string(), |
| 309 | (_, "method") => "method".to_string(), |
| 310 | (_, "class") => "class".to_string(), |
| 311 | (_, "interface") => "interface".to_string(), |
| 312 | (_, "type_alias") => "type_alias".to_string(), |
| 313 | (_, "enum") => "enum".to_string(), |
| 314 | (_, "trait") => "trait".to_string(), |
| 315 | (_, "module") => "module".to_string(), |
| 316 | (_, other) => other.to_string(), |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | #[cfg(feature = "tree-sitter-ast")] |
| 321 | fn signature_text(node: Node, source: &str) -> String { |
no test coverage detected