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

Method _detect_language

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

检测文件语言

(&self, file_path: &Path)

Source from the content-addressed store, hash-verified

375
376 /// 检测文件语言
377 fn _detect_language(&self, file_path: &Path) -> String {
378 if let Some(ext) = file_path.extension().and_then(|e| e.to_str()) {
379 match ext.to_lowercase().as_str() {
380 "rs" => "rust".to_string(),
381 "py" | "py3" | "pyx" => "python".to_string(),
382 "ts" | "tsx" => "typescript".to_string(),
383 "java" => "java".to_string(),
384 "cpp" | "cc" | "cxx" | "c++" | "c" | "h" | "hpp" | "hxx" | "hh" => "cpp".to_string(),
385 "go" => "go".to_string(),
386 _ => "unknown".to_string(),
387 }
388 } else {
389 "unknown".to_string()
390 }
391 }
392
393 /// 提取命名空间
394 fn _extract_namespace(&self, file_path: &Path) -> String {

Callers 3

parse_fileMethod · 0.45

Calls 1

to_stringMethod · 0.80

Tested by

no test coverage detected