MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / infer_language_id

Function infer_language_id

crates/opencode-cli/src/main.rs:964–990  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

962}
963
964fn infer_language_id(path: &Path) -> &'static str {
965 match path
966 .extension()
967 .and_then(|s| s.to_str())
968 .unwrap_or_default()
969 .to_ascii_lowercase()
970 .as_str()
971 {
972 "rs" => "rust",
973 "ts" | "mts" | "cts" => "typescript",
974 "tsx" => "typescriptreact",
975 "js" | "mjs" | "cjs" => "javascript",
976 "jsx" => "javascriptreact",
977 "py" => "python",
978 "go" => "go",
979 "java" => "java",
980 "kt" => "kotlin",
981 "swift" => "swift",
982 "cpp" | "cc" | "cxx" | "c" | "h" | "hpp" => "cpp",
983 "json" => "json",
984 "md" => "markdown",
985 "yaml" | "yml" => "yaml",
986 "toml" => "toml",
987 "sh" | "bash" | "zsh" => "shellscript",
988 _ => "plaintext",
989 }
990}
991
992fn append_cli_file_attachments(input: &mut String, files: &[PathBuf]) -> anyhow::Result<()> {
993 for file_path in files {

Callers 1

handle_debug_commandFunction · 0.85

Calls 1

as_strMethod · 0.45

Tested by

no test coverage detected