## Description Fixes #9387. Warp already maps `.hpp` and `.hxx` files to C++ in the LSP and file icon paths, but the syntax-highlighting language resolver only handled `.cpp`, `.cxx`, `.cc`, `.h`, and `.hh`. This adds the missing C++ header extensions to `language_by_filename` so `.hpp`, `.hxx`, and uppercase `.H` files resolve to the C++ grammar for highlighting. ## Testing - Added a regression test for `.hpp`, `.hxx`, and `.H` filename resolution. - `git diff --check` - Not run: `cargo test -p languages` because this OpenClaw host does not currently have `cargo` installed. ## Agent Mode - [ ] Warp Agent Mode - This PR was created via Warp's AI Agent Mode ## Changelog Entries for Stable CHANGELOG-BUG-FIX: Fixed missing syntax highlighting for C++ header files using `.hpp`, `.hxx`, or `.H` extensions.
35 lines
1.1 KiB
Rust
35 lines
1.1 KiB
Rust
use std::path::Path;
|
|
|
|
use crate::{language_by_filename, load_language, SUPPORTED_LANGUAGES};
|
|
|
|
/// Validate that every supported language can be loaded successfully.
|
|
/// This catches invalid node types, syntax errors, and other issues in .scm query files
|
|
/// (highlights, indents, identifiers) that would otherwise only surface at runtime.
|
|
#[test]
|
|
fn all_supported_languages_load_successfully() {
|
|
let failures: Vec<_> = SUPPORTED_LANGUAGES
|
|
.iter()
|
|
.filter(|lang| load_language(lang).is_none())
|
|
.collect();
|
|
|
|
assert!(
|
|
failures.is_empty(),
|
|
"The following languages failed to load:\n{}",
|
|
failures
|
|
.iter()
|
|
.map(|lang| format!(" - {lang}"))
|
|
.collect::<Vec<_>>()
|
|
.join("\n")
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn cpp_header_extensions_resolve_to_cpp_language() {
|
|
for filename in ["header.hpp", "header.hxx", "header.H"] {
|
|
let language = language_by_filename(Path::new(filename))
|
|
.unwrap_or_else(|| panic!("expected {filename} to resolve to C++"));
|
|
|
|
assert_eq!(language.display_name(), "C++");
|
|
}
|
|
}
|