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

Method _detect_language

rust-core/src/storage/incremental.rs:380–394  ·  view source on GitHub ↗

检测文件语言

(&self, file_path: &Path)

Source from the content-addressed store, hash-verified

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

Callers 3

_update_fileMethod · 0.45

Calls 1

to_stringMethod · 0.80

Tested by

no test coverage detected