fix: highlight C++ header extensions (#9388)

## 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.
This commit is contained in:
Prince Pal
2026-04-29 08:33:27 -04:00
committed by GitHub
parent d0f045c01b
commit 3f0ac51bc9
2 changed files with 14 additions and 2 deletions
+1 -1
View File
@@ -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" => language_by_name("cpp"),
"cpp" | "cxx" | "cc" | "h" | "hh" | "hpp" | "hxx" | "H" => language_by_name("cpp"),
"sh" | "zsh" | "bash" => language_by_name("shell"),
"cs" => language_by_name("csharp"),
"html" => language_by_name("html"),