in frontend/src/common.js [231:276]
export function filterLanguages(files) {
const cpp = isEnabled("cpp");
const cppExtensions = [
"c",
"cpp",
"cxx",
"cc",
"h",
"hh",
"hxx",
"hpp",
"inl",
"inc",
];
const js = isEnabled("js");
const jsExtensions = [
"js",
"jsm",
"mjs",
"jsx",
"xml",
"xul",
"xhtml",
"html",
];
const java = isEnabled("java");
const javaExtensions = ["java"];
const rust = isEnabled("rust");
const rustExtensions = ["rs"];
return files.filter((file) => {
if (file.type === "directory") {
return true;
} else if (cppExtensions.find((ext) => file.path.endsWith("." + ext))) {
return cpp;
} else if (jsExtensions.find((ext) => file.path.endsWith("." + ext))) {
return js;
} else if (rustExtensions.find((ext) => file.path.endsWith("." + ext))) {
return rust;
} else if (javaExtensions.find((ext) => file.path.endsWith("." + ext))) {
return java;
}
console.warn("Unknown language for " + file.path);
return false;
});
}