Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/languages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub fn language_by_filename(path: &Path) -> Option<Arc<Language>> {
"tsx" => language_by_name("tsx"),
"ts" | "cts" | "mts" => language_by_name("typescript"),
"java" | "groovy" | "gvy" | "gy" | "gsh" => language_by_name("java"),
"cpp" | "cxx" | "cc" | "h" | "hh" | "hpp" | "hxx" | "H" => language_by_name("cpp"),
"cpp" | "cxx" | "cc" | "h" | "hh" | "hpp" | "hxx" | "H" | "h++" => language_by_name("cpp"),
"sh" | "zsh" | "bash" => language_by_name("shell"),
"cs" => language_by_name("csharp"),
"html" => language_by_name("html"),
Expand Down
4 changes: 3 additions & 1 deletion crates/languages/src/lib_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ fn all_supported_languages_load_successfully() {

#[test]
fn cpp_header_extensions_resolve_to_cpp_language() {
for filename in ["header.hpp", "header.hxx", "header.H"] {
// Cover the common modern C++ header extensions (`.hpp`, `.hxx`),
// the older uppercase `.H` convention, and the rarer `.h++` form.
for filename in ["header.hpp", "header.hxx", "header.H", "header.h++"] {
let language = language_by_filename(Path::new(filename))
.unwrap_or_else(|| panic!("expected {filename} to resolve to C++"));

Expand Down