(path: &Path)
| 893 | } |
| 894 | |
| 895 | pub fn detect_language(path: &Path) -> &'static str { |
| 896 | match path.extension().and_then(|e| e.to_str()) { |
| 897 | Some("rs") => "rust", |
| 898 | Some("ts") => "typescript", |
| 899 | Some("tsx") => "typescriptreact", |
| 900 | Some("js") => "javascript", |
| 901 | Some("jsx") => "javascriptreact", |
| 902 | Some("py") => "python", |
| 903 | Some("go") => "go", |
| 904 | Some("java") => "java", |
| 905 | Some("c") => "c", |
| 906 | Some("cpp") | Some("cc") | Some("cxx") => "cpp", |
| 907 | Some("h") | Some("hpp") => "cpp", |
| 908 | Some("rb") => "ruby", |
| 909 | Some("php") => "php", |
| 910 | Some("swift") => "swift", |
| 911 | Some("kt") => "kotlin", |
| 912 | Some("scala") => "scala", |
| 913 | Some("lua") => "lua", |
| 914 | Some("json") => "json", |
| 915 | Some("yaml") | Some("yml") => "yaml", |
| 916 | Some("toml") => "toml", |
| 917 | Some("md") => "markdown", |
| 918 | Some("html") => "html", |
| 919 | Some("css") => "css", |
| 920 | Some("scss") => "scss", |
| 921 | _ => "plaintext", |
| 922 | } |
| 923 | } |
| 924 | |
| 925 | #[cfg(test)] |
| 926 | mod tests { |
no outgoing calls
no test coverage detected