Add ReasonML syntax highlighting to the TUI
What variant of Codex are you using?
Codex CLI (TUI), current main as of July 28, 2026.
What feature would you like to see?
Add first-class ReasonML syntax highlighting for Markdown code blocks and file diffs.
The TUI currently uses the two-face syntax set for code highlighting, but that set does not include a ReasonML grammar. There is also a concrete alias collision: the re token currently resolves to the "Regular Expression" syntax instead of ReasonML, so .re files can receive incorrect highlighting. .rei files and fenced code blocks labeled reason or reasonml are not properly highlighted either.
The desired behavior is:
reasonandreasonmlfenced code blocks use ReasonML highlighting..reand.reidiffs use ReasonML highlighting.- Language identifiers are matched case-insensitively, consistent with the existing lookup behavior.
Additional information
I searched existing Codex issues and pull requests for ReasonML-specific highlighting support and did not find a matching request.
I have a working local prototype with a deliberately small runtime footprint:
- Bundle an MIT-licensed
Reason.sublime-syntaxgrammar, pinned to a specific upstream revision. - Load it into a dedicated lazy
SyntaxSet, rather than rebuilding or extending the fulltwo-facesyntax set at runtime. - Route
reason,reasonml,re, andreito that grammar before the generic syntax lookup. - Return the resolved syntax together with its owning
SyntaxSet, since Syntect requires both during highlighting. - Cover alias resolution, Markdown rendering with an
instasnapshot, and.re/.reidiff rendering.
The Reason-specific tests, formatting, snapshot checks, and just fix -p codex-tui pass locally. A full codex-tui test run was also attempted; the Reason-specific coverage passed, while the highly concurrent full run had unrelated existing test failures/timeouts across app lifecycle, pets, motion, and IDE IPC areas.
Per the repository contribution policy, I am not opening an unsolicited code PR. If this direction aligns with the maintainers' intended solution and you would like the implementation submitted, I would be happy to open an invited PR.
1 Comment
A concrete reference implementation is available in my personal fork:
https://github.com/AmagiDDmxh/codex/pull/1
It includes the pinned MIT-licensed Reason grammar, lazy dedicated
SyntaxSet, explicitreason/reasonml/re/reirouting, and Markdown plus diff-rendering coverage.I kept this as a PR within the personal fork in accordance with the invitation-only contribution policy; no unsolicited PR has been opened against
openai/codex. If the approach aligns with the maintainers' intended direction, the branch is ready to be submitted upstream upon invitation.