Many C++ module filetypes don't get syntax highlighting
What version of Codex CLI is running?
codex-cli 0.139.0
What subscription do you have?
Pro
Which model were you using?
gpt-5.5
What platform is your computer?
Linux 7.0.11-1-cachyos-server x86_64 unknown
What terminal emulator and version are you using (if applicable)?
foot version: 1.26.1 +pgo +ime +graphemes +toplevel-tag +blur -assertions
Codex doctor report
What issue are you seeing?
When codex proposes a diff to *.cxx or *.cpp files, the diffs are rendered nicely with syntax highlighting.
When it proposes diffs to *.cxxm or *.ixx files, they don't get syntax highlighting. Removals are red, additions are green. These don't seem to be recognized as C++, even though *.ixx is MSVC's standard for module interface units.
What steps can reproduce the bug?
Ask codex to create or modify a file with the ixx or cxxm extension.
What is the expected behavior?
Diffs to these files to be rendered in the same way as diffs to *.cpp or *.cxx files.
An alternative solution would be to have something like .gitattributes, where you can add *.ixx linguist-language=C++ to specify how extensions are interpreted.
Additional information
_No response_
2 Comments
I took a look at this and found the issue is in the TUI syntax lookup path rather than the diff renderer itself.
diff_render::detect_lang_for_pathpasses the file extension through tohighlight_code_to_styled_spans. The syntax lookup intui/src/render/highlight.rs::find_syntaxalready patches a few aliases before calling syntect/two-face.ixxandcxxmdo not resolve in the bundled syntax set, so the renderer falls back to plain diff coloring.A minimal fix would be to add:
to that alias table. I also validated this with:
cxxmandixxmodule.ixxandmodule.cxxmadd diffs and asserts they produce syntax-highlighted RGB spansLocal validation:
just fmtjust test -p codex-tui-> 2867 passed, 4 skippedjust fix -p codex-tui-> passedSince
docs/contributing.mdsays external code contributions are invitation-only, I’m not opening an unsolicited PR. If this approach matches the intended fix, I’m happy to submit the small patch.I traced this on current
main; the issue appears to be in the extension-to-syntax mapping rather than in the diff renderer itself.Current flow:
codex-rs/tui/src/diff_render.rscallsdetect_lang_for_path(path), which returns the raw file extension string.highlight_code_to_styled_spans(...).codex-rs/tui/src/render/highlight.rs::find_syntaxhas a small patched alias table for names thattwo-facedoes not resolve by itself (csharp,c-sharp,golang,python3,shell).cxxmandixxare not in that alias table, so they do not resolve to the existing C++ syntax and the diff falls back to plain add/remove coloring.Minimal fix outline:
Suggested regression coverage:
render/highlight.rsto includecxxmandixx.diff_render.rstest that builds an added-file diff formodule.ixxandmodule.cxxm, then asserts the rendered spans contain syntax-highlighted RGB foreground colors, matching the existing.rsextension coverage.This keeps the mapping in the current single owner (
find_syntax) instead of adding another extension registry indiff_render.rs.Per
docs/contributing.md, I am not opening a PR unless a Codex maintainer explicitly invites one, but I can submit the focused patch + regression tests if wanted.