getLanguage function
Get the appropriate language for a file extension
Implementation
Language getLanguage(String filePath, String fileExtension) {
String path = filePath;
if (fileExtension.isNotEmpty) {
if (fileExtension.startsWith('.')) {
path = fileExtension;
} else {
path = ".$fileExtension";
}
}
if (path.endsWith(".c") || path.endsWith(".h")) {
return CLanguage();
} else if (path.endsWith(".cpp") ||
path.endsWith(".hpp") ||
path.endsWith(".cxx") ||
path.endsWith(".hxx")) {
return CppLanguage();
}
// Add the rest of the language detection logic
// ...
else {
return Language();
}
}